fix: allow CI pipeline to run for fork PRs - #1944
Conversation
Skip the merge-branch step for PRs from forks since GITHUB_TOKEN cannot push to external repositories. Add !failure() && !cancelled() conditions to downstream jobs so they continue running when merge-branch is skipped. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughThis pull request adds conditional logic to the GitHub Actions CI pipeline to prevent job execution when previous jobs have failed or been cancelled, and adds a check to prevent external forks from pushing to the main repository. Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/CI-pipeline.yml (1)
257-269: Missing fork check on the commit/push step.This step also uses
GITHUB_TOKENto push commits to the repository. For fork PRs, this will fail with the same "Resource not accessible by integration" error that this PR aims to fix formerge-branch.Add the fork check to the step condition:
Proposed fix
# Auto commit the changes - name: Commit new kustomization.yaml to feature branch - if: ${{ needs.build-and-push.outputs.ARRAY_OF_CHANGES != '' && github.event.pull_request.draft == false }} + if: ${{ needs.build-and-push.outputs.ARRAY_OF_CHANGES != '' && github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.repository }} working-directory: ./manifests
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/CI-pipeline.yml
🔇 Additional comments (6)
.github/workflows/CI-pipeline.yml (6)
13-15: LGTM! Fork detection logic is correct.Comparing
github.event.pull_request.head.repo.full_namewithgithub.repositoryis the standard approach to detect fork PRs in GitHub Actions.
30-33: LGTM! Correct pattern for handling skipped dependencies.The
!failure() && !cancelled()condition allows this job to run whenmerge-branchis skipped (for fork PRs), since a skipped job is neither failed nor cancelled.
73-76: LGTM!Consistent application of the
!failure() && !cancelled()guard condition.
91-95: LGTM!Consistent with the other job conditions.
134-137: LGTM!Consistent guard condition.
272-280: Guard condition is correct, but verify expected behavior for fork PRs.The
!failure() && !cancelled()addition is correct. However, this job uses secrets likeE2E_CLUSTER_KUBECONFIG(line 372) andCREATE_STATIC_NODES(line 424) which are not available to fork PRs by default.Please confirm the expected behavior: Should this job be skipped entirely for fork PRs (by adding the fork check to the job-level
if), or is it acceptable for it to fail when secrets are unavailable?
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Summary
merge-branchstep for PRs from forks sinceGITHUB_TOKENcannot push to external repositories!failure() && !cancelled()conditions to downstream jobs so they continue running whenmerge-branchis skippedFixes the "Resource not accessible by integration" error when CI is triggered by PRs from forks.
Test plan
test: validate CI fix for fork PRs #1946 - PR from fork tested here
This PR itself tests normal flow for internal PR.
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.