name: Version packages # Feature pull requests record their release impact as new files under # changes/ and never edit package versions, release notes, changelogs, or the # generated ledgers. Those shared files are written here only: after every push # to main while change files are pending, this workflow folds every pending change into # one commit on a fixed branch and keeps one pull request open for it. Merging # that pull request sets the source versions; publication still requires the # separate protected release workflow and tag. on: # Every push, not only pushes that add change files: the version branch also # rewrites generated docs, so it must be rebuilt whenever main moves. push: branches: [main] workflow_dispatch: permissions: {} concurrency: group: version-packages cancel-in-progress: true jobs: version: runs-on: ubuntu-24.04 timeout-minutes: 15 permissions: contents: write pull-requests: write env: VERSION_BRANCH: automation/version-packages steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # docs:facts:check diffs the push event's before..after range; a # merge-queue push can carry several commits, so keep full history. fetch-depth: 0 persist-credentials: false - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: 24.22.1 - name: Install workspace without lifecycle scripts run: pnpm install --frozen-lockfile --ignore-scripts - name: Apply pending change files id: apply run: | node scripts/release-changes.mjs status | tee "$RUNNER_TEMP/plan.txt" if [ -z "$(git ls-files changes | grep -v '^changes/README.md$' || true)" ]; then echo "changed=false" >> "$GITHUB_OUTPUT" exit 0 fi # The required PR release-note contract (scripts/pr-release-note.mjs) # applies to this pull request too; build the note before the change # files are deleted. node scripts/release-changes.mjs release-note > "$RUNNER_TEMP/release-note.json" pnpm changes:version pnpm docs:facts:check echo "changed=true" >> "$GITHUB_OUTPUT" - name: Commit version changes if: steps.apply.outputs.changed == 'true' run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add -A changes packages governance docs git commit -m "chore: version packages" - name: Push version branch if: steps.apply.outputs.changed == 'true' env: GH_TOKEN: ${{ github.token }} run: | gh auth setup-git git push --force origin "HEAD:$VERSION_BRANCH" - name: Open or update version pull request if: steps.apply.outputs.changed == 'true' env: GH_TOKEN: ${{ github.token }} run: | plan="$(cat "$RUNNER_TEMP/plan.txt")" note="$(cat "$RUNNER_TEMP/release-note.json")" body="$(cat <