-
Notifications
You must be signed in to change notification settings - Fork 194
189 lines (177 loc) · 7.19 KB
/
required-checks-hack-ci.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# The jobs in this workflow are necessary because they are configured as
# required checks on PRs. Github does not currently support configuring required
# checks per workflow. A PR that only triggers codegen-ci.yml jobs will only
# report back with the "Codegen Tests" check. But because there is only a global
# option for required PR checks, that PR would otherwise never satisfy the
# "Typescript/Python/APIX Tests" checks without these noop jobs.
#
# References:
# https://github.community/t/github-actions-and-required-checks-in-a-monorepo-using-paths-to-limit-execution/16586
# https://github.community/t/feature-request-conditional-required-checks/16761/6
#
# Each job actually has a corresponding "real" job
# definition in a different workflow file:
#
# codegen-ci.yml: Codegen Tests
# tssdk-ci.yml: Typescript SDK Tests
# python-ci.yml: Python SDK Tests
# apix-ci.yml: APIX Tests
# go-ci.yml: Go SDK Tests
#
name: Required Checks Hack
on:
pull_request:
push:
branches:
- main
permissions:
checks: write
jobs:
satisfy-required-checks:
name: Satisfy Required Checks
runs-on: ubuntu-latest
steps:
- name: Repo Checkout
uses: actions/checkout@v4
- uses: tony84727/[email protected]
id: filter
with:
filters: |
apix:
- 'package.json'
- 'packages/code-editor/**/*'
- 'packages/run-it/**/*'
- 'packages/api-explorer/**/*'
- 'packages/extension-api-explorer/**/*'
- 'packages/extension-utils/**/*'
- '.github/workflows/apix-ci.yml'
codegen:
- 'package.json'
- 'packages/sdk-codegen/**/*'
- 'packages/sdk-codegen-utils/**/*'
- 'packages/sdk-codegen-scripts/**/*'
- '.github/workflows/codegen-ci.yml'
hackathon:
- 'package.json'
- 'packages/wholly-sheet/**/*'
- 'packages/hackathon/**/*'
- '.github/workflows/hackathon-ci.yml'
python:
- 'python/**/*'
- '.github/workflows/python-ci.yml'
resources:
- 'bin/looker-resources-index/**/*'
- 'docs/resources/**/*'
- '.github/workflows/resources-ci.yml'
tssdk:
- 'package.json'
- 'packages/sdk/**/*'
- 'packages/sdk-rtl/**/*'
- 'packages/sdk-node/**/*'
- 'packages/extension-sdk/**/*'
- 'packages/extension-sdk-react/**/*'
- 'packages/extension-utils/**/*'
- '.github/workflows/tssdk-ci.yml'
gosdk:
- 'packages/go/**/*'
- '.github/workflows/go-ci.yml'
- name: Debug info
run: |
echo "${{ toJSON(steps.filter.outputs) }}"
echo "apix: ${{ steps.filter.outputs.apix }}"
echo "codegen: ${{ steps.filter.outputs.codegen }}"
echo "hackathon: ${{ steps.filter.outputs.hackathon }}"
echo "python: ${{ steps.filter.outputs.python }}"
echo "resources: ${{ steps.filter.outputs.resources }}"
echo "tssdk: ${{ steps.filter.outputs.tssdk }}"
echo "gosdk: ${{ steps.filter.outputs.gosdk }}"
- name: Create Codegen check
if: steps.filter.outputs.codegen == 'false'
run: |
curl --request POST \
--url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
--header "authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header "content-type: application/json" \
--header "Accept: application/vnd.github.v3+json" \
--data '{
"name": "Codegen Tests",
"head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
"output": {
"title": "Required Checks Hack / Codegen Tests",
"summary": "Associated files have not been changed so this can be skipped"
},
"conclusion": "success"
}' \
--fail
- name: Create Typescript check
if: steps.filter.outputs.tssdk == 'false'
run: |
curl --request POST \
--url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
--header "authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header "content-type: application/json" \
--header "Accept: application/vnd.github.v3+json" \
--data '{
"name": "Typescript Tests",
"head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
"output": {
"title": "Required Checks Hack / Typescript Tests",
"summary": "Associated files have not been changed so this can be skipped"
},
"conclusion": "success"
}' \
--fail
- name: Create Python check
if: steps.filter.outputs.python == 'false'
run: |
curl --request POST \
--url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
--header "authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header "content-type: application/json" \
--header "Accept: application/vnd.github.v3+json" \
--data '{
"name": "Python Tests",
"head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
"output": {
"title": "Required Checks Hack / Python Tests",
"summary": "Associated files have not been changed so this can be skipped"
},
"conclusion": "success"
}' \
--fail
- name: Create APIX check
if: steps.filter.outputs.apix == 'false'
run: |
curl --request POST \
--url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
--header "authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header "content-type: application/json" \
--header "Accept: application/vnd.github.v3+json" \
--data '{
"name": "APIX Tests",
"head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
"output": {
"title": "Required Checks Hack / APIX Tests",
"summary": "Associated files have not been changed so this can be skipped"
},
"conclusion": "success"
}' \
--fail
- name: Create Go check
if: steps.filter.outputs.gosdk == 'false'
run: |
curl --request POST \
--url https://api.github.com/repos/looker-open-source/sdk-codegen/check-runs \
--header "authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--header "content-type: application/json" \
--header "Accept: application/vnd.github.v3+json" \
--data '{
"name": "Go Tests",
"head_sha": "${{ github.event.pull_request.head.sha || github.sha }}",
"output": {
"title": "Required Checks Hack / Go Tests",
"summary": "Associated files have not been changed so this can be skipped"
},
"conclusion": "success"
}' \
--fail