forked from transitland/transitland-atlas
-
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (31 loc) · 1.07 KB
/
format.yaml
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
name: Apply opinionated DMFR format to PRs
on: [pull_request, push]
jobs:
format:
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install transitland-lib
run: scripts/install-transitland-lib.sh
- name: Format in the opinionated DMFR format
run: |
find ./feeds -type f -name "*.dmfr.json" -exec transitland dmfr format --save {} \;
- name: "If any changes: commit and push"
run: |-
git config user.name "Automated Bot"
git config user.email "[email protected]"
if ! git_status_output="$(git status --porcelain)"; then
error_code="$?"
echo "'git status' had an error: $error_code"
exit 1
elif [ -z "$git_status_output" ]; then
echo "Working directory is clean."
else
echo "Working directory has UNCOMMITTED CHANGES."
git add -A
git commit -m "Apply opinionated DMFR format"
git push
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}