-
-
Notifications
You must be signed in to change notification settings - Fork 13
53 lines (51 loc) · 1.69 KB
/
auto-updater.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
name: Automatic Data Update
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
DataUpdater:
name: Automatic Data Update
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: 20
cache: yarn
registry-url: https://registry.yarnpkg.com/
- name: Install Dependencies
run: yarn --immutable
- name: Run Smogon Tiers updater
run: yarn au:tiers
- name: Run Learnsets updater
run: yarn au:learnsets
- name: Build code
run: yarn build
- name: Start server in the background
working-directory: ./scripts
run: |
yarn start &
./wait-for-port.sh
- name: Update test data
run: yarn au:testdata
- name: Run prettier on the code
run: yarn format
- name: Commit any changes and create a pull request
env:
GITHUB_USER: github-actions[bot]
GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .;
if ! git diff-index --quiet HEAD --; then
git remote set-url origin "https://${GITHUB_TOKEN}:x-oauth-basic@github.com/${GITHUB_REPOSITORY}.git";
git config --local user.email "${GITHUB_EMAIL}";
git config --local user.name "${GITHUB_USER}";
git commit -sam "refactor: update data [skip publish]";
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
fi