-
-
Notifications
You must be signed in to change notification settings - Fork 86
58 lines (47 loc) · 1.27 KB
/
sort-data.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Sort data files
on:
push:
branches:
- main
paths:
- "_data/**"
pull_request:
paths:
- "_data/**"
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
sort-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4.2.2
with:
ref: ${{ github.head_ref }}
- name: Get changed data files
id: changed-data
uses: tj-actions/changed-files@v45.0.4
with:
files: _data/**.yml
- name: Setup Python
if: steps.changed-data.outputs.any_changed == 'true'
uses: actions/setup-python@v5.3.0
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/git-auto-commit-action@v5.0.1
if: steps.changed-data.outputs.any_changed == 'true'
with:
commit_message: Sort data files