Skip to content

chore(ci): skip no-op publishes; stop trying to push release commit#195

Merged
GSTJ merged 3 commits into
mainfrom
fix/release-skip-probe-and-no-git-push
May 19, 2026
Merged

chore(ci): skip no-op publishes; stop trying to push release commit#195
GSTJ merged 3 commits into
mainfrom
fix/release-skip-probe-and-no-git-push

Conversation

@GSTJ
Copy link
Copy Markdown
Owner

@GSTJ GSTJ commented May 19, 2026

Summary

Fixes two bugs in the 🚀 Publish workflow that combined to cause an unintended publish (and then a failed git push to main) on every push.

Issue 1 — skip probe always proceeded

The probe ran release-it --release-version --ci --no-npm --no-github and grepped its stdout for the next version. When no commits matched the (modal) scope filter, the conventional-changelog plugin returned no recommendation; release-it's Version plugin then fell back to its CI default of patch(latestVersion). Because there is no magic-modal-* git tag yet, latestVersion was 0.0.0, so the probe printed 0.0.1. 0.0.1 != 7.0.1 → the skip check proceeded → release-it bumped to 7.0.2 and published.

Replaced with a deterministic git-history probe:

  1. Boundary = most recent of: last magic-modal-* tag, last chore(release): commit, last chore(modal): sync version commit.
  2. git log <boundary>..HEAD filtered by (modal) scope or BREAKING CHANGE footer (mirrors the commitFilter in .release-it.js).
  3. Zero matches → skip=true.

Verified locally on current main: boundary correctly resolves to 08d293e (the #192 sync commit) and skip=true.

Issue 2 — GH_PAT push denied

The 🚀 Release step failed with Permission to GSTJ/react-native-magic-modal.git denied to GSTJ when release-it tried to push the version-bump commit back to main. The PAT (vintage 2024) is no longer accepted by branch protection.

Set git.push: false in packages/modal/.release-it.js. commit and tag stay true so the @release-it/github plugin still has a local tag to bind the GitHub Release to on the runner. The version bump is now runner-local only; sync to main via a follow-up PR when needed (same pattern as #192). TODO comment left in the config to re-enable push once GH_PAT is rotated with contents: write + branch-protection bypass.

Also added fetch-depth: 0 to the checkout so the probe can see full history.

Test plan

  • Probe locally returns skip=true on current main (no qualifying commits since the chore(modal): sync version, broaden release filter, skip empty publishes #192 sync)
  • Probe logic mentally verified for the feat(modal): case — git log grep matches → skip=false
  • pnpm typecheck passes
  • actionlint passes structurally (only pre-existing SC2086 warnings, unrelated)
  • On merge to main, the Publish workflow either (a) skips cleanly because nothing qualifies, or (b) when something does qualify, publishes to npm + creates a GitHub Release without trying to push back to main

The previous probe ran `release-it --release-version --ci --no-npm
--no-github` and grepped the output for a semver. When no commits match
the `(modal)` scope filter, the conventional-changelog plugin returns no
recommendation and release-it's Version plugin falls back to a CI patch
of `latestVersion` (which is `0.0.0` here because no `magic-modal-*` tag
exists yet). That printed `0.0.1`, which is not the current package
version (`7.0.1`), so the skip check incorrectly proceeded to publish.

Replace it with a deterministic git-history probe: pick the most recent
of (last `magic-modal-*` tag, last `chore(release):` commit, last
`chore(modal): sync version` commit) as the boundary, then grep
`git log <boundary>..HEAD` for `(modal)`-scoped commits or
`BREAKING CHANGE` footers. Zero matches => skip cleanly.

Also flip `.release-it.js` `git.push` to `false`. The `GH_PAT` secret
(2024-vintage) is being rejected by branch protection on push, which
crashed the workflow AFTER `npm publish` had already succeeded and left
npm and main desynced. Keep `commit: true` and `tag: true` so the
`@release-it/github` plugin still has a local tag to attach the release
to on the runner; sync the version bump back to main via a follow-up PR
(same pattern as #192). `fetch-depth: 0` is added to checkout so the
probe can see full history.
Copilot AI review requested due to automatic review settings May 19, 2026 20:13
@GSTJ GSTJ enabled auto-merge (squash) May 19, 2026 20:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Modal package release automation to (1) reliably skip no-op publishes based on deterministic git-history checks and (2) avoid failing the workflow by attempting to push release commits/tags back to main from CI.

Changes:

  • Disable release-it’s git.push for packages/modal to stop CI from pushing release commits/tags to main.
  • Update the 🚀 Publish workflow to fetch full git history and replace the “next version” probe with a boundary + commit-message-based qualifying-commit scan.
  • Improve workflow inline documentation around the previous failure mode and the new release boundary logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/modal/.release-it.js Disables CI pushing of release commit/tag while keeping local commit+tag creation for the release run.
.github/workflows/release.yml Fetches full history and replaces the version probe with deterministic boundary/grep logic to skip no-op publishes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

GSTJ added 2 commits May 19, 2026 17:44
Without these, the E2E workflow doesn't fire when a PR is first
opened — it only fires on subsequent commits (synchronize). That
caused PR #195 to sit in BLOCKED without ever running the required
check until an empty commit was pushed.
Copilot AI review requested due to automatic review settings May 19, 2026 20:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment on lines +109 to +112
# `\(modal\)` matches scoped commits; `BREAKING[- ]CHANGE` matches
# the footer added by conventional-commits for breaking changes.
QUALIFY=$(git log "$BOUNDARY..HEAD" -E --grep='\(modal\)|BREAKING[- ]CHANGE' --pretty=%s || true)
if [ -z "$QUALIFY" ]; then
Comment on lines +91 to 96
//
// TODO: once GH_PAT is rotated with `contents: write` and granted
// bypass on branch protection, flip `push` back to `true`.
push: false,
requireCleanWorkingDir: false,
tagName: "magic-modal-${version}",
@GSTJ GSTJ merged commit af7cebc into main May 19, 2026
4 checks passed
GSTJ added a commit that referenced this pull request May 19, 2026
The skip probe in `release.yml` (added in #195) used `git log --grep`
which scans the entire commit message body. The squashed PR description
for #195 mentioned `BREAKING CHANGE` in its explanation prose, which
falsely matched the regex → skip=false → release-it bumped to 7.0.2 and
tried to publish.

Net effect: 7.0.2 got published (npm has it), then the workflow died on
git push permission. Workflow status: red on main.

## Fix

Replace `git log --grep` with explicit per-commit (subject, body)
iteration using ASCII unit/record separators. Match `(modal)` only in
the subject line, and require `BREAKING CHANGE:` (or `BREAKING-CHANGE:`)
to start a body line — i.e. the actual conventional-commits footer form,
not a mention in prose.

Verified locally on `origin/main`: the merge commit of #195 is now
correctly classified as non-qualifying.

## Expected behavior next push to main

- This PR is `fix(ci):` (no `(modal)` scope, no `BREAKING CHANGE:`
footer)
- → boundary scan finds zero qualifying commits since #192
- → skip=true → workflow exits green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants