Skip to content

ci: make PR workflows work for pull requests from forks - #5772

Merged
krishna2020 merged 1 commit into
developfrom
ci/fork-pr-workflow-fixes
Nov 6, 2026
Merged

krishna2020 merged 1 commit into
developfrom
ci/fork-pr-workflow-fixes

Conversation

@krishna2020

Copy link
Copy Markdown
Collaborator

What are the changes introduced in this PR?

PRs opened from forks fail six CI checks before any of the contributor's code is tested (e.g. #5771). The workflows assume the PR branch lives in this repo and that secrets are available. Neither is true for a fork PR.

Check Cause Fix
Check for formatting & lint errors, Verify generated secret paths (verify.yml) actions/checkout used ref: github.head_ref against this repo; the fork's branch doesn't exist here, so git fetch exits 1 Check out pull_request.head.sha from pull_request.head.repo.full_name
Code Coverage (dt-test-and-report-code-coverage.yml) SonarCloud runs with an empty SONAR_TOKEN → "Not authorized" Skip Sonar on fork PRs; it still runs on push and same-repo PRs
Build (User) Transformer Docker Image – PR (build-pr-artifacts.yml) Configure AWS Credentials fails, as fork PRs get no OIDC token or registry secrets Skip the tag, build and ingestion-test jobs on fork PRs

For same-repo PRs, nothing changes. verify.yml still lints the PR head commit; it now refers to it by SHA instead of by branch name.

Security: the trigger stays pull_request (read-only token, no secrets), not pull_request_target, and persist-credentials: false is kept.

Not covered here: the org-level zizmor scan check also fails on fork PRs, at its "Mint scanner token" step. It's defined outside this repo, so it needs a separate fix there.

How was this change tested?

  • actionlint (v1.7.7) on the three workflows: no findings on changed lines (one existing set-output deprecation at dt-test-and-report-code-coverage.yml:32, untouched)
  • This PR's own CI exercises the same-repo path; a fork PR (like feat(topsort): prefix event ids with the source platform #5771) rebased onto this exercises the fork path

Checklist

  • CI workflow change only; no runtime code changes

🤖 Generated with Claude Code

- verify: check out the PR head commit from the head repo instead of
  github.head_ref on the base repo, which fails for fork branches
- coverage: skip the SonarCloud scan on fork PRs (no SONAR_TOKEN);
  still runs on push events and same-repo PRs
- build-pr-artifacts: skip image build/push jobs on fork PRs (no OIDC
  token or registry secrets)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 30c55145-fc11-474d-ae8f-4c8e81e612d4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (bed27bd) to head (1a8da34).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5772   +/-   ##
========================================
  Coverage    92.44%   92.44%           
========================================
  Files          741      741           
  Lines        41121    41121           
  Branches      9676     9590   -86     
========================================
  Hits         38015    38015           
- Misses        2845     2923   +78     
+ Partials       261      183   -78     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

@krishna2020
krishna2020 marked this pull request as ready for review November 6, 2026 08:21
@krishna2020
krishna2020 requested review from a team as code owners November 6, 2026 08:21
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the fork-PR CI compatibility changes.

No open issues 🎉

What changed in this PR

This PR makes repository CI compatible with fork pull requests by fixing checkout references and skipping jobs that require unavailable credentials, while preserving same-repository behavior.

Changes:

  • Check out the PR head repository and commit SHA for lint and secret-path verification.
  • Skip SonarCloud scans for fork PRs while retaining scans for pushes and same-repository PRs.
  • Skip artifact tagging and Docker builds for fork PRs, also preventing dependent ingestion tests from running.
File Description
.github/​workflows/​verify.yml Uses the PR’s source repository and head SHA for both checkouts.
.github/​workflows/​dt-test-and-report-code-coverage.yml Adds a fork guard to the SonarCloud scan.
.github/​workflows/​build-pr-artifacts.yml Restricts tagging and image-build jobs to same-repository PRs.

Review effort: Balanced

@krishna2020
krishna2020 merged commit 6a245da into develop Nov 6, 2026
39 checks passed
@krishna2020
krishna2020 deleted the ci/fork-pr-workflow-fixes branch November 6, 2026 11:29
krishna2020 added a commit that referenced this pull request Nov 11, 2026
## What are the changes introduced in this PR?

Adds a `fork-pr-contribution` skill
(`.claude/skills/fork-pr-contribution/SKILL.md`) so everyone handles
open-source contributions the same way:

```
fork PR ──(squash)──▶ contrib/<pr> ──(PR, full CI, merge commit)──▶ develop
```

1. **Sanity checks on the contributor PR:** lint, format, secret paths
and unit tests run on fork PRs since #5772. Lists which checks are
expected to be skipped (Docker build, ingestion test, Sonar) or to fail
(org-level zizmor `scan`).
2. **Review the diff before it reaches our repo:** in our repo it runs
with our secrets. The skill says to stop and escalate on `.github/`,
Dockerfile, npm script, lockfile or test-setup changes, and includes a
grep for env, shell and network access.
3. **Squash-merge into `contrib/<pr>`:** the squash commit is authored
by the PR author, so the contributor keeps the credit.
4. **Raise `contrib/<pr>` → `develop`:** reuses the contributor's title
and description, with a credit header.
5. **Full CI, then merge with a merge commit:** squashing here would
make the maintainer the author.

## Please explain the objectives of your changes below

Fork PRs can't run the checks that need secrets, and those checks show
as *skipped*, which branch protection treats as passing. Without a
shared process, a fork PR can be merged into `develop` without the full
CI ever running. Agreed in standup; first used on #5771 → #5774.

## Any changes to existing capabilities/behaviour?

None. Docs and agent skill only, no runtime or CI changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

4 participants