Skip to content

Commit db4aa87

Browse files
author
Alex Boten
authored
add changelog step in cicd (#4332)
This check ensures the label "skip changelog" has been applied or that the changelog has been updated. This follows the same pattern as the opentelemetry-go and opentelemetry-python SIGs.
1 parent 30e6bf6 commit db4aa87

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/changelog.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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, 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+
- main
12+
jobs:
13+
changelog:
14+
runs-on: ubuntu-latest
15+
if: "!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')"
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Check for CHANGELOG changes
21+
run: |
22+
# Only the latest commit of the feature branch is available
23+
# automatically. To diff with the base branch, we need to
24+
# fetch that too (and we only need its latest commit).
25+
git fetch origin ${{ github.base_ref }} --depth=1
26+
if [[ $(git diff --name-only FETCH_HEAD | grep CHANGELOG) ]]
27+
then
28+
echo "A CHANGELOG was modified. Looks good!"
29+
else
30+
echo "No CHANGELOG was modified."
31+
echo "Please add a CHANGELOG entry, or add the \"Skip Changelog\" label if not required."
32+
false
33+
fi

0 commit comments

Comments
 (0)