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:
co-authored by
Jesus Aguilera
parent
5c11dc7efe
commit
9bdcd7914e
Vendored
+2
-2
@@ -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`)) {
|
||||
|
||||
@@ -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`) ||
|
||||
|
||||
Reference in New Issue
Block a user