-
Notifications
You must be signed in to change notification settings - Fork 32
235 lines (209 loc) · 8.27 KB
/
pull-request.yaml
File metadata and controls
235 lines (209 loc) · 8.27 KB
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: PR Quality Checks and Preview
# Runs code quality checks (build, lint, test) on pull requests
# Additionally deploys docs preview to Vercel if docs package changed
permissions:
actions: write
contents: write
checks: read
pull-requests: write
deployments: write
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_DOCS_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }}
VERCEL_STORYBOOK_PROJECT_ID: ${{ secrets.VERCEL_STORYBOOK_PROJECT_ID }}
on:
pull_request:
types: [opened, synchronize]
concurrency:
group: pr-quality-checks-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
skip-duplicate-check:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'outdated_runs'
cancel_others: 'true'
changed-packages:
needs: skip-duplicate-check
if: needs.skip-duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
outputs:
package_changed: ${{ steps.determine-changes.outputs.package_changed }}
stories_changed: ${{ steps.determine-changes.outputs.stories_changed }}
requires_changeset: ${{ steps.determine-changes.outputs.requires_changeset }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Minimal checkout just to make the action file available
fetch-depth: 1
- name: Determine which packages changed
id: determine-changes
uses: ./.github/actions/changed-packages
with:
event-name: ${{ github.event_name }}
base-sha: ${{ github.event.pull_request.base.sha }}
fetch-depth: '0'
create-renovate-changeset:
needs: [skip-duplicate-check, changed-packages]
if: |
needs.skip-duplicate-check.outputs.should_skip != 'true' &&
github.event.pull_request.user.login == 'renovate[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Minimal checkout just to make the action file available
fetch-depth: 1
- name: Create Dependency Changeset
uses: ./.github/actions/create-dependency-changeset
with:
base-sha: ${{ github.event.pull_request.base.sha }}
pr-branch: ${{ github.event.pull_request.head.ref }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: '0'
check-changeset:
needs: [skip-duplicate-check, changed-packages]
if: |
needs.skip-duplicate-check.outputs.should_skip != 'true' &&
needs.changed-packages.outputs.requires_changeset == 'true' &&
github.event.pull_request.user.login != 'renovate[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Check for changeset
uses: ./.github/actions/check-changeset
with:
base-sha: ${{ github.event.pull_request.base.sha }}
build:
needs: skip-duplicate-check
if: needs.skip-duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Minimal checkout just to make the action file available
fetch-depth: 1
- name: Build
uses: ./.github/actions/build
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: '0'
lint:
needs: [skip-duplicate-check, build]
if: needs.skip-duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Minimal checkout just to make the action file available
fetch-depth: 1
- name: Lint
uses: ./.github/actions/lint
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: '0'
test:
needs: [skip-duplicate-check, build]
if: needs.skip-duplicate-check.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
# Minimal checkout just to make the action file available
fetch-depth: 1
- name: Test
uses: ./.github/actions/test
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: '0'
deploy-docs-preview:
runs-on: ubuntu-latest
needs: [skip-duplicate-check, changed-packages, build, lint, test]
if: |
needs.skip-duplicate-check.outputs.should_skip != 'true' &&
contains(toJson(fromJson(needs.changed-packages.outputs.package_changed).packages), '@o2s/docs')
environment:
name: docs-preview
url: ${{ steps.deploy-docs.outputs.deployment-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Prepare Environment
uses: ./.github/actions/setup-env
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Restore build outputs from cache
uses: actions/cache/restore@v5
with:
path: |
**/dist/**
**/build/**
**/.next/**
**/next-env.d.ts
!**/node_modules/**
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Deploy Docs to Vercel
id: deploy-docs
uses: ./.github/actions/deploy-vercel
timeout-minutes: 20
with:
vercel-token: ${{ secrets.VERCEL_ACCESS_TOKEN }}
vercel-org-id: ${{ env.VERCEL_ORG_ID }}
vercel-project-id: ${{ env.VERCEL_DOCS_PROJECT_ID }}
environment: preview
build-args: ''
deploy-args: ''
deploy-storybook-preview:
runs-on: ubuntu-latest
needs: [skip-duplicate-check, changed-packages, build, lint, test]
if: |
needs.skip-duplicate-check.outputs.should_skip != 'true' &&
needs.changed-packages.outputs.stories_changed == 'true'
environment:
name: storybook-preview
url: ${{ steps.deploy-storybook.outputs.deployment-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Prepare Environment
uses: ./.github/actions/setup-env
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Restore build outputs from cache
uses: actions/cache/restore@v5
with:
path: |
**/dist/**
**/build/**
**/.next/**
**/next-env.d.ts
!**/node_modules/**
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Deploy Storybook to Vercel
id: deploy-storybook
uses: ./.github/actions/deploy-vercel
timeout-minutes: 20
with:
vercel-token: ${{ secrets.VERCEL_ACCESS_TOKEN }}
vercel-org-id: ${{ env.VERCEL_ORG_ID }}
vercel-project-id: ${{ env.VERCEL_STORYBOOK_PROJECT_ID }}
environment: preview
build-args: ''
deploy-args: ''