From 3022a6217c9eb6b04e676e406374e89497db0d56 Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Sun, 1 Feb 2026 21:34:45 +0100 Subject: [PATCH 1/2] Added ability to specify multiple labels to skip check --- action.yml | 23 ++++++++++++++++++++--- check.sh | 19 ------------------- fail.sh | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 22 deletions(-) delete mode 100755 check.sh create mode 100644 fail.sh diff --git a/action.yml b/action.yml index 72dee52..d9f53f1 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ 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: @@ -15,9 +19,22 @@ runs: 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 + 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 diff --git a/check.sh b/check.sh deleted file mode 100755 index 0d63b1e..0000000 --- a/check.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -uo pipefail - -CHANGELOG_FILE="${1:-CHANGES.md}" - -if [ "${NO_CHANGELOG_LABEL}" = "true" ]; then - # 'no changelog' set, so finish successfully - exit 0 -else - # 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 -that are not user-visible." - exit 1 - fi -fi diff --git a/fail.sh b/fail.sh new file mode 100644 index 0000000..468e806 --- /dev/null +++ b/fail.sh @@ -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 +that are not user-visible." + exit 1 +fi From 835cd3d4e5057fce7978dac0353003afa43e05df Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Sun, 1 Feb 2026 21:36:43 +0100 Subject: [PATCH 2/2] Documented changes for multi-label support --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 21501ef..8a6ceb0 100644 --- a/README.md +++ b/README.md @@ -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 @@ -63,4 +66,5 @@ jobs: - uses: tarides/changelog-check-action@v2 with: changelog: CHANGES.md + labels: "no changelog,dependencies" ```