Skip to content

Commit 5aff63b

Browse files
jsollycursoragent
andauthored
fix(ci): label-gate auto-merge on ship-auto-merge (#13)
Match the fleet template: job-level if: so unlabeled PRs (Dependabot, human) never auto-merge and burn zero runner minutes. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 65824ad commit 5aff63b

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/auto-merge.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
name: Auto Merge
22

3+
# Only PRs labeled ship-auto-merge (added by /ship) get auto-merge — not every open PR.
4+
# Create the label in GitHub (Settings → Labels) before first use.
5+
# Job-level label gate: unlabeled PRs skip with ZERO billed runner minutes (label is in
6+
# the webhook payload — no gh API round-trip). StockTextAlerts uses the same if: on a
7+
# Blacksmith ARM runner; fleet default is ubuntu-latest.
8+
39
on:
410
pull_request:
511
types:
612
- opened
713
- reopened
814
- synchronize
915
- ready_for_review
16+
- labeled
1017

1118
permissions:
1219
contents: write
@@ -18,10 +25,11 @@ jobs:
1825
runs-on: ubuntu-latest
1926
if: >-
2027
github.event.pull_request.draft == false &&
21-
github.event.pull_request.head.repo.full_name == github.repository
28+
github.event.pull_request.head.repo.full_name == github.repository &&
29+
contains(github.event.pull_request.labels.*.name, 'ship-auto-merge')
2230
steps:
23-
- name: Enable auto-merge
31+
- name: Enable auto-merge when orchestrated
2432
env:
2533
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26-
PR_URL: ${{ github.event.pull_request.html_url }}
27-
run: gh pr merge --auto --squash "$PR_URL"
34+
PR_NUMBER: ${{ github.event.pull_request.number }}
35+
run: gh pr merge --auto --squash --repo "$GITHUB_REPOSITORY" "$PR_NUMBER"

0 commit comments

Comments
 (0)