| 1 |
# This action requires that any PR targeting the main branch should touch at |
| 2 |
# least one CHANGELOG file. If a CHANGELOG entry is not required, or if |
| 3 |
# performing maintenance on the Changelog, add either \"[chore]\" to the title of |
| 4 |
# the pull request or add the \"Skip Changelog\" label to disable this action. |
| 5 |
|
| 6 |
name: changelog |
| 7 |
|
| 8 |
on: |
| 9 |
pull_request: |
| 10 |
types: [opened, synchronize, reopened, labeled, unlabeled] |
| 11 |
branches: |
| 12 |
- main |
| 13 |
|
| 14 |
# Declare default permissions as read only. |
| 15 |
permissions: read-all |
| 16 |
|
| 17 |
jobs: |
| 18 |
changelog: |
| 19 |
runs-on: ubuntu-latest |
| 20 |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !contains(github.event.pull_request.title, '[chore]')}} |
| 21 |
|
| 22 |
steps: |
| 23 |
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 24 |
|
| 25 |
- name: Check for CHANGELOG changes |
| 26 |
run: | |
| 27 |
# Only the latest commit of the feature branch is available |
| 28 |
# automatically. To diff with the base branch, we need to |
| 29 |
# fetch that too (and we only need its latest commit). |
| 30 |
git fetch origin ${{ github.base_ref }} --depth=1 |
| 31 |
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]] |
| 32 |
then |
| 33 |
echo "A CHANGELOG was modified. Looks good!" |
| 34 |
else |
| 35 |
echo "No CHANGELOG was modified." |
| 36 |
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required." |
| 37 |
false |
| 38 |
fi |