-
Notifications
You must be signed in to change notification settings - Fork 443
77 lines (77 loc) · 2.52 KB
/
pr_genfiles.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
---
name: pr-genfile-checker
on:
pull_request
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
get-dev-image:
uses: ./.github/workflows/get_image.yaml
with:
image-base-name: "dev_image"
run-genfiles:
runs-on: ubuntu-latest-8-cores
needs: get-dev-image
container:
image: ${{ needs.get-dev-image.outputs.image-with-tag }}
options: --cpus 7
steps:
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
- name: go cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: /px/pkg/mod
key: go-cache-${{ hashFiles('go.sum') }}
restore-keys: |
go-cache-
- name: yarn cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ./src/ui/.yarn/cache
key: yarn-cache-${{ hashFiles('src/ui/yarn.lock', 'src/ui/.yarnrc.yml') }}
restore-keys: |
yarn-cache-
- name: Add pwd to git safe dir
run: git config --global --add safe.directory `pwd`
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
filters: |
go:
- '**/*.go'
graphql:
- '**/*.graphql'
proto:
- '**/*.proto'
sql:
- '**/*.sql'
gobuild:
- '**/*.BUILD'
- 'go.mod'
- name: Run go generate
if: ${{ steps.changes.outputs.go == 'true' || steps.changes.outputs.sql == 'true' }}
run: go generate ./...
- name: Run update go protos
if: ${{ steps.changes.outputs.proto == 'true' }}
run: scripts/update_go_protos.sh
- name: Run update ts protos
if: ${{ steps.changes.outputs.proto == 'true' }}
run: scripts/update_ts_protos.sh
- name: Run update graphql schema
if: ${{ steps.changes.outputs.graphql == 'true' }}
run: src/cloud/api/controllers/schema/update.sh
- name: Run make go-setup
if: ${{ steps.changes.outputs.go == 'true' || steps.changes.outputs.gobuild == 'true' }}
run: make go-setup
- name: Fail if any files changed
shell: bash
run: |
if [[ $(git status --porcelain=v1 | wc -l) -ne 0 ]]; then
echo "Please update generated files by running the appropriate script."
echo "Changed files:"
git diff --name-only
exit 1
fi