Advisory PR check that detects when code changes affect publishable packages but no changeset file has been added. Posts a comment on the pull request reminding the developer to run yarn changeset (or equivalent). The comment is automatically removed when a changeset is added.
This check is non-blocking and will not prevent a PR from being merged.
| Name | Required | Type | Default | Description |
|---|---|---|---|---|
| package-manager | No | string | yarn | Node package manager to use |
| is-yarn-classic | No | boolean | false | If Yarn (pre-Berry) should be used |
| pre-install-commands | No | string | Commands to run before dependency installation (e.g., configure registries, auth tokens). $NPM_TOKEN is available as an environment variable. |
|
| packages-path | No | string | packages/ | Directory prefix containing publishable packages (e.g., modules/, packages/) |
| changeset-command | No | string | yarn changeset | Command developers should run to add a changeset (shown in PR comment) |
| changeset-status-command | No | string | yarn changeset status | Command to check changeset status (shown in PR comment tips) |
| comment-header | No | string | No Changeset Detected | Header text used to identify and update/delete the bot comment on PRs |
| debug | No | boolean | false | If debug flags should be set |
| Name | Required | Description |
|---|---|---|
| NPM_TOKEN | No | NPM authentication token for private registries |
- Checks out the repository (shallow clone is sufficient).
- Sets up Node.js, Corepack, and installs dependencies.
- Fetches the list of changed files from the GitHub API (
pulls.listFiles), avoiding the need for full git history. - Determines which directories under
packages-pathhave changed and reads each directory'spackage.jsonto get the real package name (handles cases where directory names differ from package names, e.g.,modules/corecontains@aligent/take-flight). - Checks if changeset files (
.changeset/*.md, excludingREADME.md) exist. - If changeset files exist, marks the check as passing and removes any existing bot comment.
- If no changesets exist but publishable packages are affected, posts a comment listing the affected packages with instructions on how to add a changeset.
- The comment is automatically updated on subsequent pushes and removed entirely when a changeset is added.
Basic usage (packages/ directory):
name: Changeset Check
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
changeset-check:
uses: aligent/workflows/.github/workflows/changeset-check.yml@mainCustom packages path:
jobs:
changeset-check:
uses: aligent/workflows/.github/workflows/changeset-check.yml@main
with:
packages-path: "modules/"With private registry:
jobs:
changeset-check:
uses: aligent/workflows/.github/workflows/changeset-check.yml@main
with:
packages-path: "modules/"
pre-install-commands: |
yarn config set npmScopes.aligent.npmRegistryServer "https://npm.corp.aligent.consulting"
yarn config set npmScopes.aligent.npmAuthToken "$NPM_TOKEN"
yarn config set enableGlobalCache false
secrets:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}