Skip to content

Commit 28526dd

Browse files
committed
fix(companion): drop stale has-companion label + document schedule caveat
Mirror of copilot: clear() removes the has-companion label when a PR's companions are all removed; schedule default-branch caveat documented; github-script kept at @v7 to match repo convention.
1 parent d085d74 commit 28526dd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/companion-pr-check.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ on:
1717
types: [opened, edited, reopened, synchronize]
1818
branches: [staging, main]
1919
schedule:
20-
# Refresh open staging/main PRs in case the companion merges AFTER this PR
21-
# was opened (scheduled runs use the workflow from the default branch).
20+
# Refresh open staging/main PRs in case the companion merges AFTER this PR was
21+
# opened. CAVEAT: GitHub runs scheduled workflows ONLY from the DEFAULT branch's
22+
# copy of this file — so this auto-refresh activates once the workflow lands on
23+
# the default branch (via the normal promotion), not before. The pull_request
24+
# triggers below always work; re-editing the PR re-runs the check meanwhile.
2225
- cron: '*/30 * * * *'
2326
workflow_dispatch: {}
2427

@@ -104,6 +107,9 @@ jobs:
104107
async function clear(prNumber) {
105108
const ex = await findSticky(prNumber);
106109
if (ex) await github.rest.issues.deleteComment({ owner, repo, comment_id: ex.id });
110+
// Drop the label too, so a PR edited to remove all companions doesn't
111+
// keep a stale has-companion badge. 404 if not present → ignore.
112+
try { await github.rest.issues.removeLabel({ owner, repo, issue_number: prNumber, name: 'has-companion' }); } catch {}
107113
}
108114
async function ensureLabel() {
109115
try { await github.rest.issues.getLabel({ owner, repo, name: 'has-companion' }); }

0 commit comments

Comments
 (0)