Skip to content

Skip coverage PR comment on fork pull requests#1404

Merged
amilcarlucas merged 1 commit intomasterfrom
do_not_push_test_results_to_fork_repos
Mar 21, 2026
Merged

Skip coverage PR comment on fork pull requests#1404
amilcarlucas merged 1 commit intomasterfrom
do_not_push_test_results_to_fork_repos

Conversation

@amilcarlucas
Copy link
Collaborator

The orgoro/coverage action requires pull-requests: write permissions to post its summary comment. However, GitHub's default security model restricts the GITHUB_TOKEN to read-only for pull requests originating from external forks, which was resulting in pipeline failures with: HttpError: Resource not accessible by integration.

Added a condition to ensure the job only evaluates when github.event.pull_request.head.repo.full_name == github.repository, cleanly skipping the step for external contributors instead of failing.

Copilot AI review requested due to automatic review settings March 20, 2026 22:33
The `orgoro/coverage` action requires `pull-requests: write` permissions
to post its summary comment. However, GitHub's default security model
restricts the `GITHUB_TOKEN` to read-only for pull requests originating
from external forks, which was resulting in pipeline failures with:
`HttpError: Resource not accessible by integration`.

Added a condition to ensure the job only evaluates when
`github.event.pull_request.head.repo.full_name == github.repository`,
cleanly skipping the step for external contributors instead of failing.
@amilcarlucas amilcarlucas force-pushed the do_not_push_test_results_to_fork_repos branch from adf5cc9 to e988119 Compare March 20, 2026 22:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the CI workflow to avoid failing coverage-comment posting on pull requests from external forks by gating the job on whether the PR head repo matches the base repository.

Changes:

  • Add a repository-equality condition to the coverage-comment job so it only runs for non-fork PRs.


add_coverage_to_pullrequest:
if: github.event_name == 'pull_request' && (success() || failure())
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (success() || failure())
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(success() || failure()) is a common workaround to run after a failed dependency, but GitHub Actions provides always() for this use case and it also covers canceled runs. Consider replacing (success() || failure()) with always() to ensure the job runs in all terminal states while still keeping the fork guard.

Suggested change
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && (success() || failure())
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11760 10937 93% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: e988119 by action🐍

@github-actions
Copy link
Contributor

Test Results

     4 files       4 suites   40m 49s ⏱️
 3 309 tests  3 307 ✅  2 💤 0 ❌
13 028 runs  13 009 ✅ 19 💤 0 ❌

Results for commit e988119.

@amilcarlucas amilcarlucas merged commit 5ab7618 into master Mar 21, 2026
25 checks passed
@amilcarlucas amilcarlucas deleted the do_not_push_test_results_to_fork_repos branch March 21, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants