Skip to content

Harden shared release tooling (sync with jetpack-crm) - #1078

Merged
donnchawp merged 1 commit into
trunkfrom
harden-release-tooling
Jul 22, 2026
Merged

Harden shared release tooling (sync with jetpack-crm)#1078
donnchawp merged 1 commit into
trunkfrom
harden-release-tooling

Conversation

@donnchawp

Copy link
Copy Markdown
Contributor

Syncs the shared release tooling with Automattic/jetpack-crm so the config-driven release scripts stay identical across the plugin family. Five hardening fixes:

  1. Clean-tree guard (scripts/prepare-release.mjs): a new assertCleanWorkingTree() aborts before the confirmation prompt / branch creation if the working tree has uncommitted changes to tracked files. Otherwise replaceNextVersionPlaceholder()'s git add -u would sweep unrelated tracked edits into the release commit. Untracked files are excluded (no release step stages them).
  2. Remote-branch rollback cleanup (scripts/prepare-release.mjs): revertOnError() now also deletes the release branch on the remote if it was already pushed (e.g. createPR() failed after pushBranch()), so a retry isn't blocked by an orphaned remote branch. Best-effort; a failed remote cleanup won't mask the original error.
  3. Fork-merge deploy guard (.github/workflows/create-release.yml): the deploy job if: now also requires github.event.pull_request.head.repo.full_name == github.repository, so it only runs for same-repo (non-fork) release merges.
  4. SHA-pin actions (.github/workflows/create-release.yml, lint-next-version.yml): pinned the two tag-referenced actions/checkout uses to their commit SHAs (supply-chain), keeping the original ref as a trailing comment. checkout@v6.0.3df4cb1c… (matches jetpack-crm), checkout@v411d5960…. setup-php and 10up/action-wordpress-plugin-deploy were already pinned.
  5. Pre-push hook + make install-hooks: adds .githooks/pre-push (blocks direct pushes to trunk; override with --no-verify) and an install-hooks Makefile target that sets core.hooksPath. Local-only convenience guard, not CI enforcement.

Verified: node --check scripts/prepare-release.mjs passes; both workflows are valid YAML; no unpinned uses: tags remain in the two release workflows.

…rk guard, SHA-pin actions, pre-push hook

Ports fixes from Automattic/jetpack-crm to keep the shared release scripts
identical across the plugin family:
- prepare-release.mjs: refuse to prepare a release from a dirty tree (git add -u
  would otherwise sweep unrelated tracked changes into the release commit)
- prepare-release.mjs: delete the remote release branch on rollback
- create-release.yml: guard the deploy job against fork-originated release/* merges
- workflows: pin actions to commit SHAs (supply-chain)
- .githooks/pre-push + make install-hooks: fail-fast guard against direct pushes
  to the default branch
@donnchawp
donnchawp merged commit ee6afd9 into trunk Jul 22, 2026
7 checks passed
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.

1 participant