-
Notifications
You must be signed in to change notification settings - Fork 184
38 lines (32 loc) · 1.21 KB
/
whats-new.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
name: Check What's new update
on:
push:
branches: [develop]
pull_request:
branches: [develop]
jobs:
check-whats-news:
runs-on: ubuntu-latest
steps:
- name: Check for file changes in PR
run: |
pr_number=${{ github.event.pull_request.number }}
response=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${pr_number}/files")
file_changed=false
file_to_check="docs/source/whats_new.rst" # Specify the path to your file
for file in $(echo "${response}" | jq -r '.[] | .filename'); do
if [ "$file" == "$file_to_check" ]; then
file_changed=true
break
fi
done
if $file_changed; then
echo "File ${file_to_check} has been changed in the PR."
else
echo "File ${file_to_check} has not been changed in the PR."
echo "::error::File ${file_to_check} has not been changed in the PR."
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token