forked from ExpTechTW/API
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (45 loc) · 1.48 KB
/
Copy pathstation-json-check.yml
File metadata and controls
53 lines (45 loc) · 1.48 KB
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
name: Station JSON Check
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "resource/station-dev.json"
pull_request:
types: [opened, synchronize, reopened]
paths:
- "resource/station-dev.json"
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
persist-credentials: true
sparse-checkout: |
resource/station-dev.json
resource/station.json
scripts/station-json-check.ts
sparse-checkout-cone-mode: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Run station JSON check
run: bun run scripts/station-json-check.ts
- name: Commit and push changes
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# 設置 remote URL 包含 PAT token
git remote set-url origin https://x-access-token:$PAT_TOKEN@github.com/${{ github.repository }}.git
git add resource/station.json
git diff --staged --quiet || git commit -m "chore: update station.json from station-dev.json [skip ci]"
git push origin main