Skip to content

Commit 1d21890

Browse files
authored
Add workflow to check for presence of CHANGELOG changes on PRs (open-telemetry#1067)
1 parent a2c75c6 commit 1d21890

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/changelog.yml

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

0 commit comments

Comments
 (0)