Conversation
Mirror of copilot: move TRAILER/REF into parseCompanions + use matchAll instead of module-scoped g-flagged regexes with manual lastIndex resets (greptile P2). Behavior unchanged.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR refactors the companion PR check GitHub Actions workflow: it removes the scheduled 30-minute cron trigger (relying on PR events and manual
Confidence Score: 4/5Safe to merge — the regex scoping and matchAll migration are correct, and the label/error-handling changes are sound. The two findings are cosmetic/operational and do not affect the core check logic. The core regex fix (moving TRAILER/REF inside parseCompanions and switching to matchAll) is correct and eliminates the class of shared-state bugs. Label rename logic is consistent across ensureLabel/addLabels/clear. The only gaps are a leftover exec-loop inconsistency on SQUASH (not a runtime bug, just style) and the fact that the old has-companion label will linger on existing PRs with no automatic cleanup path. .github/workflows/companion-pr-check.yml — the SQUASH exec loop and the has-companion label migration are worth a second look before merging. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([PR opened / edited / synced\nor workflow_dispatch]) --> B{Event type?}
B -- pull_request --> C[checkPR on context.payload.pull_request]
B -- workflow_dispatch --> D[Paginate open PRs on staging & main]
D --> C
C --> E[collectCompanions pr]
E --> F[parseCompanions pr.body\nTRAILER + REF via matchAll]
F --> G{base = main?}
G -- yes --> H[Paginate commits\nSQUASH regex → featurePR numbers]
H --> I[parseCompanions each feature PR body]
I --> E2[Merge & de-dup companion list]
G -- no --> E2
E2 --> J{companions.length === 0?}
J -- yes --> K[clear: delete sticky comment\nremoveLabel LABEL]
J -- no --> L[ensureLabel\ngetLabel → 404 → createLabel]
L --> M[addLabels LABEL to PR]
M --> N[For each companion\ncrossGetPR via PAT fetch]
N --> O{companion merged?}
O -- yes, same base --> P[✅ line]
O -- yes, wrong base --> Q[⚠️ line\nwarn=true]
O -- no --> R[❌ line\nwarn=true]
O -- error --> S[❓ line\nwarn=true]
P & Q & R & S --> T[upsert sticky comment\nwith heading + lines]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A([PR opened / edited / synced\nor workflow_dispatch]) --> B{Event type?}
B -- pull_request --> C[checkPR on context.payload.pull_request]
B -- workflow_dispatch --> D[Paginate open PRs on staging & main]
D --> C
C --> E[collectCompanions pr]
E --> F[parseCompanions pr.body\nTRAILER + REF via matchAll]
F --> G{base = main?}
G -- yes --> H[Paginate commits\nSQUASH regex → featurePR numbers]
H --> I[parseCompanions each feature PR body]
I --> E2[Merge & de-dup companion list]
G -- no --> E2
E2 --> J{companions.length === 0?}
J -- yes --> K[clear: delete sticky comment\nremoveLabel LABEL]
J -- no --> L[ensureLabel\ngetLabel → 404 → createLabel]
L --> M[addLabels LABEL to PR]
M --> N[For each companion\ncrossGetPR via PAT fetch]
N --> O{companion merged?}
O -- yes, same base --> P[✅ line]
O -- yes, wrong base --> Q[⚠️ line\nwarn=true]
O -- no --> R[❌ line\nwarn=true]
O -- error --> S[❓ line\nwarn=true]
P & Q & R & S --> T[upsert sticky comment\nwith heading + lines]
|
Summary
Fix companion workflow regex
Type of Change
Testing
Manual
Checklist