Skip to content
Open
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ the changelog check will re-run and succeed automatically. This label can also
be applied directly when opening the PR so the check will be automatically
omitted.

You can also set a custom set of labels using the `labels` inputs (separated by
commas). If ANY of the labels matches, the check is skipped.

## Options

The file that is being checked by default is called `CHANGES.md` but you can
Expand Down Expand Up @@ -63,4 +66,5 @@ jobs:
- uses: tarides/changelog-check-action@v2
with:
changelog: CHANGES.md
labels: "no changelog,dependencies"
```
23 changes: 20 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,33 @@ inputs:
description: Which file to use for checking that the changelog was modified
required: false
default: CHANGES.md
labels:
description: The labels (semicolon separated) that allow a PR to pass without modifying the changelog
required: false
default: "no changelog"
runs:
using: composite
steps:
- name: Checkout tree
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check for changes in changelog
- name: Check PR labels
shell: bash
id: skip-check
run: |
IFS=',' read -ra WANT <<< "${{ inputs.labels }}"
PR_LABELS="${{ join(github.event.pull_request.labels.*.name, ' ') }}"
for w in "${WANT[@]}"; do
if [[ " $PR_LABELS " == *" $w "* ]]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, I'd suggest iterating over PR_LABELS without joining them.

echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "skip=false" >> "$GITHUB_OUTPUT"
- name: Alert for missing changes in changelog
if: steps.skip-check.outputs.skip == 'true'
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
NO_CHANGELOG_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no changelog') }}
run: ${{ github.action_path }}/check.sh "${{ inputs.changelog }}"
run: ${{ github.action_path }}/fail.sh "${{ inputs.changelog }}"
shell: bash
19 changes: 0 additions & 19 deletions check.sh

This file was deleted.

14 changes: 14 additions & 0 deletions fail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -uo pipefail

CHANGELOG_FILE="${1:-CHANGES.md}"

# a changelog check is required
# fail if the diff is empty
if git diff --exit-code "origin/${BASE_REF}" -- "${CHANGELOG_FILE}"; then
echo >&2 "User-visible changes should come with an entry in the changelog. This behavior
can be overridden by using the \"no changelog\" label, which is used for changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect at this point, would need to specify the right labels.

that are not user-visible."
exit 1
fi