From f5aeafffb7295dc850472e8604e9560ef06db348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Sun, 10 Nov 2024 00:54:34 +0100 Subject: [PATCH] CI: check that the changelog is populated on each pull request --- .github/workflows/check_pr.yml | 41 ++++++++++++++++++++++++++++++++ .github/workflows/check_push.yml | 19 --------------- CHANGELOG.md | 4 ++++ 3 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/check_pr.yml delete mode 100644 .github/workflows/check_push.yml diff --git a/.github/workflows/check_pr.yml b/.github/workflows/check_pr.yml new file mode 100644 index 000000000..8b9bd4dbb --- /dev/null +++ b/.github/workflows/check_pr.yml @@ -0,0 +1,41 @@ +name: Check branch conformity +on: + pull_request: + +jobs: + prevent-fixup-commits: + runs-on: ubuntu-latest + env: + target: debian-bookworm + distro: debian + version: bookworm + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: prevent fixup commits + run: | + git fetch origin + git status + git log --pretty=format:%s origin/main..HEAD | grep -ie '^fixup\|^wip' && exit 1 || true + + check-changelog: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: ensure CHANGELOG.md is populated + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + NO_CHANGELOG_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no changelog') }} + shell: bash + run: | + if [ "${NO_CHANGELOG_LABEL}" = "true" ]; then + exit 0 + else + if git diff --exit-code "origin/${BASE_REF}" -- CHANGELOG.md; then + echo "::error::No CHANGELOG.md modifications found in this pull request. You can override this check by adding the 'no changelog' label to the pull request." + exit 1 + fi + fi \ No newline at end of file diff --git a/.github/workflows/check_push.yml b/.github/workflows/check_push.yml deleted file mode 100644 index 588ef486c..000000000 --- a/.github/workflows/check_push.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check branch conformity -on: - pull_request: - -jobs: - prevent-fixup-commits: - runs-on: ubuntu-latest - env: - target: debian-bookworm - distro: debian - version: bookworm - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: prevent fixup commits - run: | - git fetch origin - git status - git log --pretty=format:%s origin/main..HEAD | grep -ie '^fixup\|^wip' && exit 1 || true diff --git a/CHANGELOG.md b/CHANGELOG.md index 31f149b48..6ca9ac95e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.or - Platform support: Drop support for Fedora 39, since it's end-of-life ([#999](https://github.com/freedomofpress/dangerzone/pull/999)) +### Development changes + +- CI: Check that the changelog is populated on each pull request ([#995](https://github.com/freedomofpress/dangerzone/pull/995)) + ## [0.8.0](https://github.com/freedomofpress/dangerzone/compare/v0.8.0...0.7.1) ### Added