Merge pull request #192 from IanCa/main #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update schemas with changes | |
on: | |
push: | |
branches: ["*"] | |
jobs: | |
check_changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Get complete history | |
- name: Get latest push changes | |
id: changed-files | |
# if: github.base_ref != 'main' && github.event.action == 'synchronize' | |
uses: tj-actions/changed-files@v44 | |
with: | |
since_last_remote_commit: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: List all changed files | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
for file in "$ALL_CHANGED_FILES"; do | |
echo "$file was changed" | |
done | |
- name: Install dependencies | |
run: pip install git+https://github.com/hed-standard/hed-python.git@develop | |
- name: Update schemas | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
hed_update_schemas $ALL_CHANGED_FILES | |
- name: Push schema changes | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add . | |
if git diff --staged --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Automated schema changes" | |
git push | |
fi | |