-
-
Notifications
You must be signed in to change notification settings - Fork 89
57 lines (47 loc) · 1.34 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
name: Sort data files
on:
push:
branches:
- main
paths:
- "_data/**"
pull_request:
paths:
- "_data/**"
workflow_dispatch:
jobs:
sort-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if changed data files
id: changed-data
uses: tj-actions/[email protected]
with:
files: _data/**.yml
files_ignore: _data/**/strings.yml
- 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
if [[ $(basename $file) == "strings.yml" ]]; then
continue
fi
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