Skip to content

Commit 192b089

Browse files
chore: skip redundant checks on release, enforce main HEAD in bin/release (#18)
Add an origin/main HEAD guard to bin/release so releases can only be cut from the latest CI-verified main commit. With that invariant, remove the check job from both release workflows (release.yml, release-python.yml) and delete the now-orphaned check.yml reusable workflow. bin/check still runs locally as a safeguard. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bc56883 commit 192b089

File tree

4 files changed

+18
-34
lines changed

4 files changed

+18
-34
lines changed

.github/workflows/check.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/release-python.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ permissions:
1313
contents: read
1414

1515
jobs:
16-
check:
17-
uses: ./.github/workflows/check.yml
18-
1916
build:
2017
name: Build (${{ matrix.target }})
21-
needs: check
2218
runs-on: ${{ matrix.os }}
2319
strategy:
2420
fail-fast: false
@@ -60,7 +56,6 @@ jobs:
6056

6157
sdist:
6258
name: Build sdist
63-
needs: check
6459
runs-on: ubuntu-latest
6560
steps:
6661
- uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ permissions:
1313
contents: read
1414

1515
jobs:
16-
check:
17-
uses: ./.github/workflows/check.yml
18-
1916
build:
2017
name: Build (${{ matrix.target }})
21-
needs: check
2218
runs-on: ${{ matrix.os }}
2319
strategy:
2420
fail-fast: false

bin/release

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ usage() {
1010
echo "Tag and push a release for the current version."
1111
echo ""
1212
echo "Pre-flight checks:"
13+
echo " - HEAD matches origin/main (override with --force)"
1314
echo " - Working tree is clean (override with --allow-dirty)"
1415
echo " - bin/check passes"
1516
echo " - Git tag does not already exist on GitHub"
1617
echo " - Package version does not already exist on PyPI"
1718
echo ""
1819
echo "Options:"
19-
echo " --force Skip GitHub tag and PyPI existence checks"
20+
echo " --force Skip GitHub tag, PyPI, and origin/main checks"
2021
echo " --allow-dirty Skip clean working tree check"
2122
exit "${1:-0}"
2223
}
@@ -60,6 +61,22 @@ else
6061
echo " skipping clean working tree check (--allow-dirty)"
6162
fi
6263

64+
# ---------- verify HEAD is latest main ----------
65+
66+
if [ "$FORCE" = false ]; then
67+
git fetch origin main --quiet
68+
LOCAL_SHA=$(git rev-parse HEAD)
69+
REMOTE_SHA=$(git rev-parse origin/main)
70+
if [ "$LOCAL_SHA" != "$REMOTE_SHA" ]; then
71+
echo "ERROR: HEAD ($LOCAL_SHA) does not match origin/main ($REMOTE_SHA)." >&2
72+
echo " Check out the latest main before releasing, or use --force to override." >&2
73+
exit 1
74+
fi
75+
echo " HEAD matches origin/main"
76+
else
77+
echo " skipping origin/main check (--force)"
78+
fi
79+
6380
# ---------- run checks ----------
6481

6582
echo "Running bin/check..."

0 commit comments

Comments
 (0)