-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (28 loc) · 1.16 KB
/
check-scripts-updates.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
name: Check Script and Playbook Updates
on:
pull_request:
paths:
- 'scripts/**'
jobs:
check-updates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if scripts/ were updated without corresponding updates in playbooks/
run: |
BASE_COMMIT=${{ github.event.pull_request.base.sha }}
HEAD_COMMIT=${{ github.event.pull_request.head.sha }}
changed_files=$(git diff --name-only "$BASE_COMMIT" "$HEAD_COMMIT")
# Check if any files in scripts/ were updated (excluding wrap_scripts_in_yaml.py)
scripts_updated=$(echo "$changed_files" | grep -v 'wrap_scripts_in_yaml.py' | grep 'scripts/' || true)
echo "Scripts updated: $scripts_updated"
# Check if any files in playbooks/ were updated
playbooks_updated=$(echo "$changed_files" | grep 'playbooks/' || true)
echo "Playbooks updated: $playbooks_updated"
if [[ -n "$scripts_updated" && -z "$playbooks_updated" ]]; then
echo "Files in scripts/ were updated without corresponding updates in playbooks/"
exit 1
fi
echo "Check passed"