diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a720098..901adc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,11 @@ jobs: - name: Changelog entry if: github.event_name == 'pull_request' run: | - if git diff --quiet "origin/${{ github.base_ref }}...HEAD" -- CHANGELOG.md; then - echo "CHANGELOG.md was not changed by this pull request." - echo "Every pull request adds a line under Unreleased in CHANGELOG.md that says what it changes." + number="${{ github.event.pull_request.number }}" + added=$(git diff "origin/${{ github.base_ref }}...HEAD" -- CHANGELOG.md | grep -E '^\+[^+]' || true) + if ! echo "$added" | grep -qE "\(#${number}\)[[:space:]]*$"; then + echo "CHANGELOG.md has no new line that ends with this pull request's number, (#${number})." + echo "Every pull request adds a line under Unreleased in CHANGELOG.md that says what it changes" + echo "and ends with its own number, for example: - \`GET /tasks\` lists the tasks. (#${number})" exit 1 fi diff --git a/CHANGELOG.md b/CHANGELOG.md index d929b82..7a7e5d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,4 +6,4 @@ what it changes for someone who uses the API. CI checks that it did. ## Unreleased - `GET /tasks/count` says how many tasks there are, and how many are done. -- CI checks that a pull request adds a line here. +- CI checks that a pull request adds a line here that ends with its number. (#4)