From 257171ccb4bf9a64797fa65458eaaa59c71eaff8 Mon Sep 17 00:00:00 2001 From: PoonHarpoon <52467605+PoonHarpoon@users.noreply.github.com> Date: Sun, 1 Nov 2026 17:05:43 +0000 Subject: [PATCH 1/2] ci: skip the artifact comment on pull requests from forks GitHub gives pull_request runs from a fork a read-only GITHUB_TOKEN, whatever the workflow asks for, so issues.createComment is refused and the job is marked failed although the APK built and was uploaded. Only comment when the branch is in this repository (and not on manual workflow_dispatch runs, which have no pull request to comment on). --- .github/workflows/debug.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index ebb9cb87e7..a91b057356 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -42,7 +42,8 @@ jobs: retention-days: 7 - name: Comment PR with artifact link - if: success() + # Pull requests from forks get a read-only GITHUB_TOKEN, so the comment would fail the job. + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository uses: actions/github-script@v7 with: script: | From 105affc6bea4bb3080dc5879b1fe0fde400a5189 Mon Sep 17 00:00:00 2001 From: Land Date: Tue, 3 Nov 2026 20:18:26 +0530 Subject: [PATCH 2/2] ci: harden PR artifact notifications, step summary, and error handling --- .github/workflows/debug.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index a91b057356..6f5e886598 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -40,16 +40,24 @@ jobs: name: debug-apk path: app/build/outputs/apk/debug/app-debug.apk retention-days: 7 + overwrite: true + + - name: Add artifact link to summary + if: success() + run: | + echo "### Debug APK" >> $GITHUB_STEP_SUMMARY + echo "Download artifact: [debug-apk](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY - name: Comment PR with artifact link # Pull requests from forks get a read-only GITHUB_TOKEN, so the comment would fail the job. - if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo != null && github.event.pull_request.head.repo.full_name == github.repository + continue-on-error: true uses: actions/github-script@v7 with: script: | - const runUrl = `https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}`; + const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; const comment = `Debug APK built successfully!\n\nDownload artifact: [debug-apk](${runUrl})\n\n_Artifact will be available for 7 days_`; - github.rest.issues.createComment({ + await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo,