diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index ebb9cb87e7..6f5e886598 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -40,15 +40,24 @@ jobs: name: debug-apk path: app/build/outputs/apk/debug/app-debug.apk retention-days: 7 + overwrite: true - - name: Comment PR with artifact link + - 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 != 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,