Skip to content

Apply pause presets to job triggers #4620

Apply pause presets to job triggers

Apply pause presets to job triggers #4620

name: Changelog Preview
# Renders the CHANGELOG.md section the next release would generate from the
# .nextchanges/ fragments into this check's job summary, so reviewers see the
# rendered changelog without cutting a release. Fails the check if a fragment
# is misplaced (so it can't be silently skipped by the renderer).
#
# Runs on pull requests (rendering the PR's own .nextchanges/ content) and on
# pushes to main (so anyone can view the preview for any commit on main). Uses
# a read-only token: it only reads .nextchanges/ and never needs write
# credentials.
on:
pull_request:
types: [opened, reopened, synchronize]
paths:
- ".github/workflows/changelog-preview.yml"
- ".nextchanges/**"
- "internal/genkit/**"
- "tools/validate_nextchanges.py"
push:
branches:
- main
permissions:
contents: read
jobs:
preview:
runs-on: ubuntu-latest
env:
NEXTCHANGES_DIR: '.nextchanges'
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Full history so the validator can infer each fragment's PR from the
# squash-merge commit that added it (see tools/validate_nextchanges.py).
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
version: "0.8.9"
# Fail the check on a misplaced/unexpected file under .nextchanges/ so it
# can't slip through as a silently-skipped (unrendered) fragment. Running in
# CI (GITHUB_ACTIONS) makes the trailing PR link mandatory and checks it
# names the right PR. PR_NUMBER is the authoritative event PR (empty on push
# to main, where each fragment's PR is inferred from its squash-merge
# commit); it must have full history to attribute fragments, hence the
# fetch-depth: 0 checkout above. BASE_REF is the PR's base branch, so a
# gh-stacked PR's inherited fragments (which already carry the earlier PR's
# link) aren't attributed to this PR.
- name: Validate .nextchanges placement
env:
PR_NUMBER: ${{ github.event.number }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: uv run tools/validate_nextchanges.py
- name: Render changelog preview
run: |-
# Render into a variable first so a renderer error fails this step
# (rather than being swallowed by a pipe), then emit the .md directly
# into the job summary so GitHub renders it as the changelog.
# --frozen installs from the committed lock as-is. --locked re-validates
# it against a requires-python that uv infers from the runner's default
# interpreter (the genkit-synced script declares none), so it broke when
# ubuntu-latest moved to 26.04 (Python 3.14).
preview=$(uv run --frozen internal/genkit/tagging.py --preview)
{
echo '## Changelog preview'
echo ''
echo 'This is a preview of what the next release would add to CHANGELOG.md based on `.nextchanges/`.'
echo ''
echo '_NOTE: the date and version are computed at release time._'
echo ''
echo '---'
echo ''
echo "$preview"
} >> "$GITHUB_STEP_SUMMARY"