Skip to content

Commit 4314a9b

Browse files
Add sync-label check: PRs need the maintainer-applied 'sync' label (#1473)
## What A required-check candidate that fails unless the PR carries the `sync` label. The label needs triage+ permission, so external contributors can't self-apply it — and maintainers must perform one deliberate act before a PR becomes mergeable, which is exactly the accidental-merge failure mode this guards against. Replaces the old `[sync]`-in-title convention (titles are author-controlled, i.e. spoofable). The error message routes non-sync PRs to CONTRIBUTING.md's mirror flow. Temporary: goes away once release automation owns merging. ## Try it This PR itself is the test: the `sync-label` check should be failing right now. Applying the `sync` label should turn it green (the `labeled` event re-runs it); removing the label flips it back. ## Follow-ups (not this PR) - Add `sync-label` to the required status checks in the repo ruleset (eng-dev-ecosystem) so it actually blocks. - Sync the workflow file into the Universe subtree so the next release sync doesn't delete it. This pull request and its description were written by Isaac. --------- Signed-off-by: Hector Castejon Diaz <hector.castejon@databricks.com>
1 parent 8de8d38 commit 4314a9b

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/sync-label.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This repository is a read-only mirror; the only PRs that should
2+
# merge are the release sync PRs from the internal source of truth.
3+
# This check fails unless the PR carries the `sync` label, which only
4+
# maintainers can apply — making every merge a deliberate act.
5+
# Temporary guard until release automation takes over merging.
6+
name: Sync label
7+
8+
on:
9+
pull_request:
10+
types: [opened, reopened, synchronize, labeled, unlabeled]
11+
# The label gate runs at PR level — a PR can't enter the merge queue
12+
# until this check passes there. Merge-group events carry no label
13+
# context, so on them the job passes trivially; without this trigger
14+
# a required sync-label check would stall every queue entry.
15+
merge_group:
16+
types: [checks_requested]
17+
18+
jobs:
19+
sync-label:
20+
name: sync-label
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Merge queue — gate already applied at PR level
24+
if: ${{ github.event_name == 'merge_group' }}
25+
run: echo "merge group — sync label was enforced when the PR entered the queue."
26+
- name: Require the `sync` label
27+
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'sync') }}
28+
run: |
29+
echo "::error::This PR does not carry the 'sync' label. This repository is a read-only mirror — only release sync PRs merge here. If this IS a release sync PR, a maintainer must apply the 'sync' label; community contributions are re-applied in the internal repository instead (see CONTRIBUTING.md)."
30+
exit 1
31+
- name: Label present
32+
if: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'sync') }}
33+
run: echo "sync label present — this is a release sync PR."

0 commit comments

Comments
 (0)