-
Notifications
You must be signed in to change notification settings - Fork 66
deployment: adds workflow which injects a check-box to PR description case of changes in services.rs #12948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main-v0.14.2
Are you sure you want to change the base?
deployment: adds workflow which injects a check-box to PR description case of changes in services.rs #12948
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Cross-Repo Sync Check | ||
|
|
||
| on: | ||
| pull_request: | ||
| # 'edited' allows the check to pass the moment the dev clicks the box | ||
| # 'synchronize' handles new commits | ||
| types: [opened, synchronize, edited] | ||
| paths: | ||
| - "crates/apollo_deployments/src/service.rs" | ||
| - ".github/workflows/sync_check.yaml" | ||
|
|
||
| jobs: | ||
| manage-sync: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: write | ||
| steps: | ||
| - name: Sync Checkbox Logic | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const checkbox = "- [ ] I have synced these changes to **Private Repo Y**"; | ||
| const checked = "- [x] I have synced these changes to **Private Repo Y**"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Placeholder "Private Repo Y" not replaced with actual nameHigh Severity The strings Additional Locations (2) |
||
|
|
||
| // 1. Fetch the latest PR body (don't rely on the 'context' which might be stale) | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: context.issue.number | ||
| }); | ||
|
|
||
| const body = pr.body || ""; | ||
| const hasCheckbox = body.includes("- [ ] I have synced") || body.includes("- [x] I have synced"); | ||
|
|
||
| // 2. If Cursor BOT or the Dev hasn't added the checkbox, append it. | ||
| if (!hasCheckbox) { | ||
| const newBody = body + "\n\n---\n### ⚠️ Cross-Repo Sync Required\n" + checkbox + "\n*The private repo Y depends on these config changes.*"; | ||
| await github.rest.pulls.update({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: context.issue.number, | ||
| body: newBody | ||
| }); | ||
| core.setFailed("Added sync checklist. Please update Private Repo Y and check the box."); | ||
| return; | ||
| } | ||
|
|
||
| // 3. Final enforcement: Is it checked? | ||
| if (body.includes(checked)) { | ||
| console.log("Sync confirmed!"); | ||
| } else { | ||
| core.setFailed("Please check the 'Sync to Private Repo Y' box once the private repo is aligned."); | ||
| } | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Paths filter ineffective for PR edited events
Medium Severity
The
pathsfilter is not reliably enforced forpull_requesteditedevents. When anyone edits any PR's body or title, the workflow may fire regardless of whether the PR touchesservice.rs. This can inject the sync checkbox into unrelated PRs and fail their checks unexpectedly.