generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (31 loc) · 1.23 KB
/
check-news-md.yaml
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
# All PRs into main MUST be deliberately labelled in the NEWS.md with a succint but informative entry
# describing the changes made - this workflow checks to make sure that this has been done.
name: Check NEWS.md Update
on:
pull_request:
branches:
- main
jobs:
check-news-md-modification:
name: Check NEWS.md modification
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Check for NEWS.md changes
run: |
echo "Current SHA: $GITHUB_SHA"
echo "Base SHA: ${{ github.event.pull_request.base.sha }}"
git fetch origin ${{ github.event.pull_request.base.ref }}
CHANGED_FILES=$(git diff --name-only $GITHUB_SHA $(git merge-base $GITHUB_SHA origin/${{ github.event.pull_request.base.ref }}))
echo "Changed files:"
echo "$CHANGED_FILES"
if echo "$CHANGED_FILES" | grep -q "NEWS.md"; then
echo "NEWS.md has been modified."
else
echo "::error file=NEWS.md,line=1,col=5::NEWS.md must be updated with each PR." >&2
exit 1
fi
shell: /usr/bin/bash -e {0}