From 16ecea2bf2b5c2415aac9b69259348583efa4acf Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Wed, 10 Jul 2024 17:17:57 +0200 Subject: [PATCH] Introduce a workflow that checks for changelog entries --- .../unreleased/INTERNAL-20240710-172718.yaml | 6 ++++ .github/workflows/check-changelog.yml | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .changes/unreleased/INTERNAL-20240710-172718.yaml create mode 100644 .github/workflows/check-changelog.yml diff --git a/.changes/unreleased/INTERNAL-20240710-172718.yaml b/.changes/unreleased/INTERNAL-20240710-172718.yaml new file mode 100644 index 00000000..4ea9b231 --- /dev/null +++ b/.changes/unreleased/INTERNAL-20240710-172718.yaml @@ -0,0 +1,6 @@ +kind: INTERNAL +body: Introduce a workflow that checks for changelog entries +time: 2024-07-10T17:27:18.567311+02:00 +custom: + Issue: "1759" + Repository: terraform-ls diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 00000000..95077903 --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -0,0 +1,36 @@ +# Checks if a file has been committed under the .changes/unreleased directory +# +# Skip PRs labeled with 'dependencies' + +on: + pull_request: + branches: + - main + - pre-release + +name: Check if changelog entry exists + +jobs: + changelog_existence: + name: Check if changelog entry exists + if: "!contains(github.event.pull_request.labels.*.name, 'dependencies')" + runs-on: ubuntu-latest + + steps: + - name: Check if changelog file was added + # https://github.com/marketplace/actions/paths-changes-filter + # For each filter, it sets output variable named by the filter to the text: + # 'true' - if any of changed files matches any of filter rules + # 'false' - if none of changed files matches any of filter rules + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changelog_check + with: + filters: | + exists: + - added|modified: '.changes/unreleased/**.yaml' + + - name: Fail job if changelog entry is missing and required + if: steps.changelog_check.outputs.exists == 'false' + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: core.setFailed('Changelog entry required to merge.')