From af9cd89dcd8df8cc231917bcc678f859f9e7300e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Thu, 26 Jun 2025 16:25:07 +0200 Subject: [PATCH] Create check-changelog.yml --- .github/workflows/check-changelog.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/check-changelog.yml diff --git a/.github/workflows/check-changelog.yml b/.github/workflows/check-changelog.yml new file mode 100644 index 0000000..72d5814 --- /dev/null +++ b/.github/workflows/check-changelog.yml @@ -0,0 +1,49 @@ +name: Check if the CHANGELOG.md has been modified +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled, edited] +jobs: + check-changelog: + if: github.event.pull_request.base.ref == 'develop' + runs-on: ubuntu-latest + steps: + - name: Check for 'skip-changelog' label + id: check-label + uses: actions/github-script@v7 + with: + result-encoding: string + script: | + const labels = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const hasLabel = labels.data.some(label => label.name === 'skip-changelog'); + return hasLabel; + - name: Eval if changelog can be omited + id: skip-check + run: | + echo "Label: ${{ steps.check-label.outputs.result }}" + echo "Comment: ${{ steps.check-body.outputs.result }}" + if [[ "${{ steps.check-label.outputs.result }}" == "true" ]]; then + echo "SKIP=true" >> $GITHUB_ENV + else + echo "SKIP=false" >> $GITHUB_ENV + fi + - name: Code checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + - name: CHANGELOG.md verify + if: env.SKIP != 'true' + run: | + git fetch origin develop --depth=1 + git checkout ${{ github.head_ref }} + git diff --name-only FETCH_HEAD > changed_files.txt + if grep -xq "CHANGELOG.md" changed_files.txt; then + echo "CHANGELOG.md updated ✅" + else + echo "CHANGELOG.md not updated ❌" + exit 1 + fi