diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 768007b..b6e990b 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -15,6 +15,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify tag is on main + run: | + git merge-base --is-ancestor "$GITHUB_SHA" origin/main || { + echo "Tag $GITHUB_REF_NAME ($GITHUB_SHA) is not on main; refusing to publish." + exit 1 + } - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index c5dad7e..89f5a01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### CI + +- Restrict npm publishing to tags whose commit is already on `main`. + ## [0.2.5] - 2026-07-14 ### Changed