-
Notifications
You must be signed in to change notification settings - Fork 3
50 lines (50 loc) · 2.27 KB
/
check-data-update.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
name: Get Kengxxiao/ArknightsGameData latest commit SHA
on:
schedule:
# Every 15 minutes
- cron: "0/15 * * * *"
jobs:
get-commit-sha:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
- name: Fetch latest CN commit SHA
run: |
SHA=$(curl -sL https://api.github.com/repos/Kengxxiao/ArknightsGameData/commits/master | jq -r ".sha")
if [ "$SHA" != "null" ]; then
echo $SHA > data/.game-data-sha
fi
- name: Check for modified CN commit SHA
id: git-check-cn
run: echo "modified=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")" >> $GITHUB_OUTPUT
- name: Commit latest CN commit SHA
if: steps.git-check-cn.outputs.modified == 'true'
run: |
git config --global user.name 'Mizuki'
git config --global user.email 'mizuki@arknights'
git add data/.game-data-sha
git commit -m "chore: update latest CN game data commit SHA" \
-m "This is an automated commit triggered by GitHub Actions. Data repository: Kengxxiao/ArknightsGameData"
- name: Fetch latest Yostar commit SHA
run: |
SHA=$(curl -sL https://api.github.com/repos/Kengxxiao/ArknightsGameData_YoStar/commits/main | jq -r ".sha")
if [ "$SHA" != "null" ]; then
echo $SHA > data/.game-data-yostar-sha
fi
- name: Check for modified Yostar commit SHA
id: git-check-yostar
run: echo "modified=$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")" >> $GITHUB_OUTPUT
- name: Commit latest Yostar commit SHA
if: steps.git-check-yostar.outputs.modified == 'true'
run: |
git config --global user.name 'Mizuki'
git config --global user.email 'mizuki@arknights'
git add data/.game-data-yostar-sha
git commit -m "chore: update latest Yostar game data commit SHA" \
-m "This is an automated commit triggered by GitHub Actions. Data repository: Kengxxiao/ArknightsGameData_YoStar"
- name: Push commits
if: steps.git-check-cn.outputs.modified == 'true' || steps.git-check-yostar.outputs.modified == 'true'
run: |
git push