Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 3 additions & 74 deletions .github/workflows/changeset-check.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,16 @@
name: Changeset Check

# Friendly, NON-BLOCKING nudge: if a pull request changes source but adds no
# changeset, leave a single comment explaining how to add one. If a changeset is
# later added, the comment is removed. This never fails the build - it only
# keeps the release-notes pipeline fed.
# Thin caller for the shared org workflow. Non-blocking: comments when a pull
# request adds no changeset, removes the comment when one appears.

on:
pull_request_target:
types: [opened, synchronize, reopened]
branches: [main]

permissions:
contents: read
pull-requests: write

jobs:
changeset-check:
runs-on: ubuntu-latest
# Skip the automated "Version Packages" PR - it never needs a changeset.
if: github.head_ref != 'changeset-release/main'
steps:
- name: Checkout PR head # nosemgrep
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Detect a changeset in this PR
id: detect
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Only consider real changeset entries (*.md), not README.md/config.json.
ADDED=$(git diff --name-only --diff-filter=A "$BASE_SHA" "$HEAD_SHA" \
| { grep -E '^\.changeset/.+\.md$' || true; } \
| { grep -v -E '^\.changeset/README\.md$' || true; })
if [ -n "$ADDED" ]; then
echo "has-changeset=true" >> "$GITHUB_OUTPUT"
else
echo "has-changeset=false" >> "$GITHUB_OUTPUT"
fi

- name: Comment if missing (or clean up if present)
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const marker = '<!-- changeset-check -->';
const hasChangeset = ${{ steps.detect.outputs.has-changeset }};
const {owner, repo} = context.repo;
const issue_number = context.issue.number;

const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number,
});
const existing = comments.find(c => c.body && c.body.includes(marker));

if (hasChangeset) {
if (existing) {
await github.rest.issues.deleteComment({owner, repo, comment_id: existing.id});
}
return;
}

const body = [
marker,
"### No changeset found",
"",
"This PR does not add a changeset, so it will not appear in the changelog or trigger a release.",
"",
"If the change is user-facing, add one:",
"",
"```bash",
"pnpm changeset",
"```",
"",
"Pick a bump (patch / minor / major) and write the changelog entry in our usual voice (\"Added **X**... Thanks to @you. Closes #123.\"), then commit the generated `.changeset/*.md` file.",
"",
"If this PR is docs-only or a chore that needs no release note, you can ignore this - or run `pnpm changeset --empty` to record that intentionally.",
].join("\n");

if (existing) {
await github.rest.issues.updateComment({owner, repo, comment_id: existing.id, body});
} else {
await github.rest.issues.createComment({owner, repo, issue_number, body});
}
uses: Nano-Collective/.github/.github/workflows/changeset-check.yml@main
23 changes: 1 addition & 22 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,7 @@ jobs:
uses: Nano-Collective/.github/.github/workflows/pr-checks.yml@main
with:
fail-on-coverage-drop: true

# Validates changeset package names to prevent main branch breakages.
# Uses a custom script instead of `changeset status` to keep the check non-blocking.
changeset-validation:
name: Changeset Validation
runs-on: ubuntu-latest
# Skip for the automated "Version Packages" PR.
if: github.head_ref != 'changeset-release/main'
steps:
# Dependency-free check, no pnpm install needed.
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'

- name: Validate every changeset resolves to a workspace package
run: node scripts/validate-changesets.js
validate-changesets: true

# Tests and builds the VS Code extension.
vscode-extension:
Expand Down
47 changes: 6 additions & 41 deletions .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,19 @@
name: Prepare Release (Version PR)

# Keeps a single open "Version Packages" pull request up to date. As changesets
# land on main, this PR accumulates them, bumps package.json, and rolls the
# entries into CHANGELOG.md (in our house style, via changeset:version).
# Thin caller for the shared org workflow. Everything lives in
# Nano-Collective/.github — change it there and every repo picks it up.
#
# This workflow NEVER publishes. Merging the Version PR pushes a version bump to
# main, which the existing release.yml detects and publishes. That split keeps
# release.yml the single source of truth for publishing.
# This never publishes. Merging the Version Packages PR it maintains pushes a
# version bump to main, which release.yml detects and publishes.

on:
push:
branches: [main]

# Avoid racing the Version PR against itself on rapid merges.
concurrency:
group: release-prepare
cancel-in-progress: false

permissions:
contents: write
pull-requests: write

jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0

- name: Setup pnpm
uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
with:
node-version: '22'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create or update the Version Packages PR
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
# Only run the versioning step. No `publish:` input, so this action
# never runs `changeset publish` - release.yml owns publishing.
version: pnpm run changeset:version
title: 'chore: version packages'
commit: 'chore: version packages'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-prepare:
uses: Nano-Collective/.github/.github/workflows/release-prepare.yml@main
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"test:lint": "biome lint .",
"test:lint:fix": "biome check --write --unsafe .",
"test:knip": "knip",
"test:changesets": "node scripts/validate-changesets.js",
"test:audit": "pnpm audit --audit-level=high --ignore-unfixable",
"audit": "pnpm audit",
"test:security": "semgrep scan --config auto --error",
Expand Down
115 changes: 0 additions & 115 deletions scripts/validate-changesets.js

This file was deleted.

Loading