Skip to content

Conversation

@takyyon
Copy link
Contributor

@takyyon takyyon commented Jan 9, 2026

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

The PR coverage workflow fails when attempting to post a comment on PRs from forks. This is because fork PRs don't have write permissions to the base repository.

Error observed:

RequestError [HttpError]: Resource not accessible by integration
status: 403

Fix:

  1. Detect fork PRs using context.payload.pull_request?.head?.repo?.fork
  2. Skip comment posting for fork PRs (early return with informative log)
  3. Add try-catch around comment posting to handle 403 errors gracefully
  4. Log messages directing users to the workflow summary for coverage results

The coverage check itself still runs and reports results in the GitHub Actions step summary - only the PR comment is skipped for forks.

Impact of Change

  • Users: Fork PR contributors will see coverage results in workflow summary instead of PR comment
  • Developers: No change for internal PRs
  • System: Workflow no longer fails on fork PRs due to permission issues

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: GitHub Actions workflow run

Manual Testing Evidence

Why automated tests are not feasible:
This is a GitHub Actions workflow that can only be tested by running in CI. The fork detection logic uses GitHub's context payload which is only available during workflow execution.

Verification approach:

  1. The fix adds proper fork detection using GitHub's standard context API
  2. The try-catch provides a fallback for any edge cases where fork detection might not work
  3. This PR will run the workflow and verify it passes without attempting to comment

Related issue:

Contributors

@krrishmittal

Screenshots/Videos

N/A - CI workflow changes only

- Detect fork PRs and skip comment posting (no write permissions)
- Add try-catch to handle 403 permission errors gracefully
- Log informative messages directing users to workflow summary
- Prevents workflow failure when PR is from a fork

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings January 9, 2026 16:33
@takyyon takyyon added the risk:low Low risk change with minimal impact label Jan 9, 2026
@takyyon takyyon enabled auto-merge (squash) January 9, 2026 16:33
@github-actions
Copy link

github-actions bot commented Jan 9, 2026

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(ci): Handle fork PRs gracefully in coverage comment step
  • Issue: None — title is clear, follows conventional commit style, and describes the scope and intent of the change.
  • Recommendation: No change needed.

Commit Type

  • Properly selected (fix)
  • Note: Only one commit type selected which is correct for this change.

Risk Level

  • Risk label on the PR: risk:low and the PR body selects Low
  • Assessment: Label matches the PR body and the change scope (CI workflow only) justifies low risk.

What & Why

  • Current: The body explains that the coverage workflow fails for fork PRs, outlines the 403 error observed, and lists the concrete fix steps: detect fork PRs, skip comment posting, add try/catch, and log guidance.
  • Issue: None — concise and focused.
  • Recommendation: Consider adding a short one-line example of the log message users will see (optional) or linking to the failing run referenced (PR fix(designer): Add A2A Request operation and connector group to Consumption search menu #8683) for easier traceability.

Impact of Change

  • Impact is clearly stated and scoped to CI and fork PRs.
  • Recommendation: For completeness, you may add the specific workflow filename changed (e.g., .github/workflows/coverage.yml) and mention that internal PR behavior is unchanged.
    • Users: Fork PR contributors will see coverage in the workflow summary instead of a PR comment
    • Developers: No change for internal PRs
    • System: Workflow no longer fails on fork PRs due to permission issues

Test Plan

  • The PR marks Manual testing completed and describes why automated tests are not feasible for this GitHub Actions context. It also indicates the fix was tested in a GitHub Actions run.
  • Recommendation: Add the Actions run URL or workflow run id as evidence in the PR body so reviewers can quickly validate the successful run.

Contributors

  • Contributors are listed (@krrishmittal). Good practice.
  • Recommendation: If others contributed (e.g., reviewers or cherrypicked commits), add them as Co-authored-by lines (optional).

Screenshots/Videos

  • N/A — CI workflow change only. This is acceptable.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level No change needed
What & Why Optionally link failing run or show example log
Impact of Change Optionally add workflow filename changed
Test Plan Add Actions run URL / run id for verification
Contributors No change needed
Screenshots/Videos N/A — no visual changes

Final Message:
This PR passes the PR title/body checklist. The advised risk level is risk:low, which matches the label on the PR.

Actionable suggestions (small, optional) to make review and verification faster:

  • Add a link to the successful GitHub Actions run that demonstrates the fixed behavior (paste the run URL in the Test Plan section).
  • Optionally note the exact workflow file path changed (.github/workflows/...) in the Impact section so reviewers can quickly find the change.

Thanks — this is a well-written PR description that gives reviewers enough context to approve the CI-only fix. Please update with the run link if available and proceed.


Last updated: Fri, 09 Jan 2026 16:34:20 GMT

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

📊 Coverage check completed. See workflow run for details.

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

This PR fixes a permission error in the PR coverage workflow that occurs when PRs are opened from forks. Fork PRs lack write permissions to the base repository, causing the workflow to fail with a 403 error when attempting to post coverage comments.

Key Changes:

  • Add fork detection logic using GitHub's context API to identify fork PRs early
  • Wrap comment posting in try-catch to handle permission errors gracefully
  • Provide informative log messages directing users to workflow summary for coverage results

@takyyon takyyon merged commit 4b9b43a into main Jan 9, 2026
22 checks passed
@takyyon takyyon deleted the fix/pr-coverage-fork-comment-handling branch January 9, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants