-
Notifications
You must be signed in to change notification settings - Fork 2
44 lines (38 loc) · 1.76 KB
/
reusable-changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This action requires that any PR should touch at
# least one CHANGELOG file.
name: Reusable changelog
on:
workflow_call:
jobs:
changelog-entry:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !startsWith(github.head_ref, 'renovate/')}}
steps:
- uses: actions/checkout@v4
- name: Debug Labels
run: |
echo "${{ toJson(github.event.pull_request.labels[*].name) }}"
echo "Should Run: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') && !startsWith(github.head_ref, 'renovate/')}}"
- name: Check for CHANGELOG file changes
run: |
# Only the latest commit of the feature branch is available
# automatically. To diff with the base branch, we need to
# fetch that too (and we only need its latest commit).
git fetch origin ${{ github.base_ref }} --depth=1
echo "$(git diff --name-only FETCH_HEAD)"
if [[ $(git diff --name-only FETCH_HEAD | grep --ignore-case CHANGELOG.md) ]]
then
echo "The CHANGELOG file was modified. Looks good!"
else
echo "The CHANGELOG file was not modified."
echo "Please add a CHANGELOG entry to the appropriate header under \"Unreleased\", or add the \"Skip Changelog\" label if not required."
false
fi
lint-changelog:
runs-on: ubuntu-latest
needs: changelog-entry
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if CHANGELOG is valid
uses: newrelic/release-toolkit/validate-markdown@v1