fix: paginate workflow discovery (#438)

* fix: paginate workflow discovery for repos with >30 workflows in workflow_dispatch commands (#437)

* Fetch all workflows with paginate

* Add page parameter when fetching all workflows

* fix: formatting and dist

---------

Co-authored-by: Jesus Aguilera <[email protected]>
This commit is contained in:
Peter Evans
2025-12-18 16:52:02 +00:00
committed by GitHub
co-authored by Jesus Aguilera
parent 5c11dc7efe
commit 9bdcd7914e
2 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -391,8 +391,8 @@ class GitHubHelper {
getWorkflow(repository, workflowName) {
return __awaiter(this, void 0, void 0, function* () {
core.debug(`Getting workflow ${workflowName} for repository ${repository}`);
const { data: workflows } = yield this.octokit.rest.actions.listRepoWorkflows(Object.assign({}, this.parseRepository(repository)));
for (const workflow of workflows.workflows) {
const workflows = yield this.octokit.paginate('GET /repos/{owner}/{repo}/actions/workflows', Object.assign(Object.assign({}, this.parseRepository(repository)), { per_page: 100 }));
for (const workflow of workflows) {
core.debug(`Found workflow: ${workflow.path}`);
if (workflow.path.endsWith(`${workflowName}.yml`) ||
workflow.path.endsWith(`${workflowName}.yaml`)) {
+5 -3
View File
@@ -189,12 +189,14 @@ export class GitHubHelper {
workflowName: string
): Promise<string> {
core.debug(`Getting workflow ${workflowName} for repository ${repository}`)
const {data: workflows} = await this.octokit.rest.actions.listRepoWorkflows(
const workflows = await this.octokit.paginate(
'GET /repos/{owner}/{repo}/actions/workflows',
{
...this.parseRepository(repository)
...this.parseRepository(repository),
per_page: 100
}
)
for (const workflow of workflows.workflows) {
for (const workflow of workflows) {
core.debug(`Found workflow: ${workflow.path}`)
if (
workflow.path.endsWith(`${workflowName}.yml`) ||