From 0d1aeaf8aaeea68f5dbb2f8a4a32eebb374db7be Mon Sep 17 00:00:00 2001 From: Uruk Date: Mon, 29 Sep 2025 23:55:36 +0200 Subject: [PATCH] fix(ci): improve workflow run condition and artifact collection Fixes workflow trigger condition by explicitly checking for workflow_run event type to prevent unintended executions. Improves artifact collection reliability by switching to the correct API method and increasing page size to capture more artifacts from multiple builds. Removes redundant artifact fetching logic that was duplicating collection efforts. --- .github/workflows/artifact-comment.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/artifact-comment.yml b/.github/workflows/artifact-comment.yml index 60244409..f7d5ff04 100644 --- a/.github/workflows/artifact-comment.yml +++ b/.github/workflows/artifact-comment.yml @@ -16,7 +16,7 @@ on: jobs: comment-artifacts: - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.event == 'pull_request' + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request') runs-on: ubuntu-latest permissions: contents: read @@ -63,11 +63,11 @@ jobs: console.log(`Processing PR #${pr.number} for commit ${pr.head.sha.substring(0, 7)}`); // Get all recent workflow runs for this PR to collect artifacts from multiple builds - const { data: workflowRuns } = await github.rest.actions.listWorkflowRuns({ + const { data: workflowRuns } = await github.rest.actions.listWorkflowRunsForRepo({ owner: context.repo.owner, repo: context.repo.repo, head_sha: pr.head.sha, - per_page: 10 + per_page: 20 }); // Filter for build workflows only @@ -106,13 +106,6 @@ jobs: console.log(`Collected ${allArtifacts.length} total artifacts from all builds`); - // Get artifacts from current run if needed - const { data: artifacts } = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: runId - }); - // Sort and categorize all collected artifacts const androidArtifacts = allArtifacts .filter(a => a.name.includes('android'))