Skip to content

Refactor the CLI, with each subcommand in its own file. #14

Refactor the CLI, with each subcommand in its own file.

Refactor the CLI, with each subcommand in its own file. #14

Workflow file for this run

name: Changelog
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
# We want to check modified files from base_ref (merge target) to the current commit,
# so we need the full history of the current branch.
fetch-depth: 0
- name: Check for skip label
id: check-skip
run: |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'skip-changelog') }}" == "true" ]]; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Skipping changelog validation due to skip-changelog label"
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Validate changelog entry
if: steps.check-skip.outputs.skip == 'false'
run: |
# --quiet implies --exit-code (but doesn't produce output).
# --exit-code exits 1 if there are differences, or 0 if there are no differences.
# So: this command exits 1 if CHANGELOG.md was changed between the base and HEAD,
# or 0 if there are no diffs.
if git diff --quiet origin/"${{ github.base_ref }}"...HEAD -- CHANGELOG.md; then
echo "::error::No changelog entry found. Please add an entry to CHANGELOG.md or add the 'skip-changelog' label if this change does not require a changelog entry."
exit 1
else
echo "Changelog has been updated"
fi