-
Notifications
You must be signed in to change notification settings - Fork 85
69 lines (56 loc) · 1.69 KB
/
automated-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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: AutomatedUpdate
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
paths:
- scripts/update-pwa.js
schedule:
- cron: '0 0 * * 1'
env:
NODE_VERSION: 18.16.0
jobs:
CancelPrevious:
runs-on: ubuntu-latest
steps:
- name: Cancel Old Pipeline
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AutomatedUpdate:
needs: [CancelPrevious]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
if: github.ref != 'refs/heads/develop'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.ref == 'refs/heads/develop'
with:
ref: develop
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Create Update Branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub CI"
git switch -c update/automated-update
- name: Run Update Script
run: node scripts/update-pwa
- name: Run Automated Fixes
run: |
npm run lint -- --fix
npm run format
git add .
git commit -m "chore: post update fixes" --allow-empty
- name: Run Tests
run: npm run test
- name: Push Update Branch
if: always()
run: git push --force origin update/automated-update