-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (76 loc) · 2.9 KB
/
code-generation-cleanup.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Code generation and cleanup on pull
on:
pull_request:
branches:
- main
jobs:
generate-and-commit-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.ACTION_COMMIT }}
- name: Cache go dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go_dependencies-${{ hashFiles('go.sum', 'go.work.sum') }}
restore-keys: |
go_dependencies-${{ hashFiles('go.sum', 'go.work.sum') }}
go_dependencies-
- name: Cache node modules
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{hashFiles('package-lock.json')}}
restore-keys: |
node_modules-${{hashFiles('package-lock.json')}}
node_modules-
- name: Cache elm dependencies
uses: actions/cache@v4
with:
path: |
~/.elm
elm-stuff
key: "elm-dependencies-\
${{hashFiles('elm.json', 'review/elm.json')}}"
restore-keys: |
elm-dependencies-${{hashFiles('elm.json', 'review/elm.json')}}
elm-dependencies-
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 21.x
cache: "npm"
- name: Create empty file in webroot
run: mkdir -p webroot && touch webroot/empty
- name: Install go dependencies
run: go install
- name: Install npm dependencies
run: npm ci
- name: Run generate
run: npm run generate
- name: Run cleanup
run: npm run cleanup
- name: Run tests
run: npm run test
- name: Build project
run: npm run build
- name: Run cleanup
run: npm run cleanup
- name: Commit and Push Generated Code
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update generated code and cleanup" -a || echo "No changes to commit"
git push