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
55 changes: 55 additions & 0 deletions .github/workflows/changelog-fragments.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Changelog fragment check

on:
workflow_call:
inputs:
sdk-rust-path:
description: Path to the pinned sdk-rust checkout; use '.' in sdk-rust itself
required: true
type: string
fragments-directory:
description: Repository-relative directory containing category folders
default: changelog
type: string

permissions:
contents: read
pull-requests: read

jobs:
changelog-check:
name: Changelog checkpoint
runs-on: ubuntu-latest
steps:
- name: Check current override label
id: override
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
# Events may arrive out of order; query the current labels.
labels=$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq '.labels[].name')
if grep -Fxq 'skip-changelog' <<< "$labels"; then
echo 'skip=true' >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: steps.override.outputs.skip != 'true'
with:
fetch-depth: 0
submodules: true
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
if: steps.override.outputs.skip != 'true'
- name: Require and validate category fragments
if: steps.override.outputs.skip != 'true'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
SDK_RUST_PATH: ${{ inputs.sdk-rust-path }}
FRAGMENTS_DIRECTORY: ${{ inputs.fragments-directory }}
run: |
set -euo pipefail
cargo run --quiet \
--manifest-path "$SDK_RUST_PATH/crates/changelog-release-notes/Cargo.toml" \
--bin changelog-tool -- check --repo "$GITHUB_WORKSPACE" \
--fragments "$FRAGMENTS_DIRECTORY" --base "$BASE_SHA" --require-new
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ label changes can rerun the check and the `skip-changelog` override remains
available. Callers grant `contents: read` for checkout and `pull-requests: read`
so the shared workflow can read the pull request's current labels.

`changelog-fragments.yml` is the alternative for SDKs migrating to per-PR
Markdown fragments. It uses the caller's pinned sdk-rust `changelog-tool`, requires
a new fragment in a category folder, and validates pending fragments. The existing
`changelog.yml` remains available for repositories that have not migrated.

Pass `sdk-rust-path` (the submodule path, or `.` in sdk-rust itself) and optionally
`fragments-directory` (default `changelog`). Callers retain the pull request event
types `opened`, `synchronize`, `reopened`, `labeled`, and `unlabeled`, the same read
permissions, and the `skip-changelog` override. Pin the workflow to a reviewed
commit, and update the caller's sdk-rust pin to a revision containing the tool
before switching workflows.


## Why do this

Expand Down
Loading