Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fab739c

Browse filesBrowse files
cmarmoNicolasHug
andauthored
CI Add workflow to check Changelog entry. (#19155)
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
1 parent 5c24622 commit fab739c
Copy full SHA for fab739c

File tree

1 file changed

+54
-0
lines changed
Filter options

1 file changed

+54
-0
lines changed

‎.github/workflows/check-changelog.yml

Copy file name to clipboard
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check Changelog
2+
# This check makes sure that the changelog is properly updated
3+
# when a PR introduces a change in a test file.
4+
# To bypass this check, label the PR with "No Changelog Needed".
5+
on:
6+
pull_request:
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
if: ${{ contains(github.event.pull_request.labels.*.name, 'No Changelog Needed') == 0 }}
12+
steps:
13+
- name: Get PR number and milestone
14+
run: |
15+
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
16+
echo "TAGGED_MILESTONE=${{ github.event.pull_request.milestone.title }} >> $GITHUB_ENV
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: '0'
20+
- name: Check the changelog
21+
run: |
22+
set -xe
23+
changed_files=$(git diff --name-only origin/master)
24+
# Changelog should be updated only if tests have been modified
25+
if [[ ! "$changed_files" =~ tests ]]
26+
then
27+
exit 0
28+
fi
29+
all_changelogs=$(cat ./doc/whats_new/v*.rst)
30+
if [[ "$all_changelogs" =~ :pr:\`$PR_NUMBER\` ]]
31+
then
32+
echo "Changelog has been updated."
33+
# If the pull request is milestoned check the correspondent changelog
34+
if exist -f ./doc/whats_new/v${TAGGED_MILESTONE:0:4}.rst
35+
then
36+
expected_changelog=$(cat ./doc/whats_new/v${TAGGED_MILESTONE:0:4}.rst)
37+
if [[ "$expected_changelog" =~ :pr:\`$PR_NUMBER\` ]]
38+
then
39+
echo "Changelog and milestone correspond."
40+
else
41+
echo "Changelog and milestone do not correspond."
42+
echo "If you see this error make sure that the tagged milestone for the PR"
43+
echo "and the changelog name properly match."
44+
exit 1
45+
fi
46+
fi
47+
else
48+
echo "Changelog entry is missing."
49+
echo "If you see this error and there is already a changelog entry then make sure that"
50+
echo "the PR number is correct. If no changelog entry is required for this PR,"
51+
echo "label the PR with 'No Changelog Needed' to bypass this check."
52+
exit 1
53+
fi
54+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.