Skip to content

Add pre-commit script and job for syncing scripts to ansible playbooks #1

Add pre-commit script and job for syncing scripts to ansible playbooks

Add pre-commit script and job for syncing scripts to ansible playbooks #1

name: Check Script and Playbook Updates
on:
push:
paths:
- 'scripts/**'
jobs:
check-updates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for Matching Updates in Scripts and Playbooks
run: |
#!/bin/bash
set -e
# Get list of changed files in last commit
changed_files=$(git diff --name-only HEAD HEAD~1)
# 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/')
# Check if any files in playbooks/ were updated
playbooks_updated=$(echo "$changed_files" | grep 'playbooks/')
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"