Merge pull request #266 from devsnasnuvens/new-devops-terms #17
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: Sort data files | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "assets/data/**" | |
pull_request: | |
paths: | |
- "assets/data/**" | |
workflow_dispatch: | |
jobs: | |
sort-data: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Get changed data files | |
id: changed-data | |
uses: tj-actions/[email protected] | |
with: | |
files: assets/data/**.json | |
- name: Setup Python | |
if: steps.changed-data.outputs.any_changed == 'true' | |
uses: actions/[email protected] | |
with: | |
python-version: "3.12" | |
- name: Sort data files | |
if: steps.changed-data.outputs.any_changed == 'true' | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-data.outputs.all_changed_files }} | |
run: | | |
for file in $ALL_CHANGED_FILES; do | |
echo "Formatting $file" | |
python3 format_data.py -f $file | |
done | |
# commit all changed files back to the repository | |
- uses: stefanzweifel/[email protected] | |
if: steps.changed-data.outputs.any_changed == 'true' | |
with: | |
commit_message: Sort data files |