Skip to content

Commit cf077d4

Browse files
deployment: adds workflow which injects a check-box to PR description case of changes in services.rs
1 parent b8e6d6a commit cf077d4

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/sync_check.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Cross-Repo Sync Check
2+
3+
on:
4+
pull_request:
5+
# 'edited' allows the check to pass the moment the dev clicks the box
6+
# 'synchronize' handles new commits
7+
types: [opened, synchronize, edited]
8+
paths:
9+
- "crates/apollo_deployments/src/service.rs"
10+
- ".github/workflows/sync_check.yaml"
11+
12+
jobs:
13+
manage-sync:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- name: Sync Checkbox Logic
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const checkbox = "- [ ] I have synced these changes to **Private Repo Y**";
23+
const checked = "- [x] I have synced these changes to **Private Repo Y**";
24+
25+
// 1. Fetch the latest PR body (don't rely on the 'context' which might be stale)
26+
const { data: pr } = await github.rest.pulls.get({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
pull_number: context.issue.number
30+
});
31+
32+
const body = pr.body || "";
33+
const hasCheckbox = body.includes("- [ ] I have synced") || body.includes("- [x] I have synced");
34+
35+
// 2. If Cursor BOT or the Dev hasn't added the checkbox, append it.
36+
if (!hasCheckbox) {
37+
const newBody = body + "\n\n---\n### ⚠️ Cross-Repo Sync Required\n" + checkbox + "\n*The private repo Y depends on these config changes.*";
38+
await github.rest.pulls.update({
39+
owner: context.repo.owner,
40+
repo: context.repo.repo,
41+
pull_number: context.issue.number,
42+
body: newBody
43+
});
44+
core.setFailed("Added sync checklist. Please update Private Repo Y and check the box.");
45+
return;
46+
}
47+
48+
// 3. Final enforcement: Is it checked?
49+
if (body.includes(checked)) {
50+
console.log("Sync confirmed!");
51+
} else {
52+
core.setFailed("Please check the 'Sync to Private Repo Y' box once the private repo is aligned.");
53+
}

0 commit comments

Comments
 (0)