Skip to content

Commit 492d341

Browse files
committed
Require approval before starting a CI run
1 parent a62f49c commit 492d341

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.github/workflows/ci.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ name: Validate everything
55
push:
66
branches:
77
- master
8-
pull_request:
8+
pull_request_target:
9+
types:
10+
- labeled
911
branches:
1012
- master
1113
env:
1214
DOCKER_HUB_USERNAME: shepmaster
1315
GH_CONTAINER_REGISTRY_USERNAME: shepmaster
1416
AWS_ACCESS_KEY_ID: AKIAWESVHZ3J6SV43YWE
1517
jobs:
18+
debug:
19+
runs-on: ubuntu-latest
20+
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
21+
steps:
22+
- run: echo '${{ secrets.AWS_SECRET_ACCESS_KEY }}' | wc
23+
- run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | wc
24+
- run: echo '${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}' | wc
25+
- run: echo '${{ secrets.PLAYGROUND_GITHUB_TOKEN }}' | wc
1626
build_compiler_containers:
1727
name: Build ${{ matrix.channel }} compiler container
1828
runs-on: ubuntu-latest
@@ -22,6 +32,7 @@ jobs:
2232
- stable
2333
- beta
2434
- nightly
35+
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
2536
env:
2637
IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-rust-${{ matrix.channel }}
2738
steps:
@@ -124,6 +135,7 @@ jobs:
124135
- clippy
125136
- miri
126137
- rustfmt
138+
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
127139
env:
128140
IMAGE_NAME: ghcr.io/integer32llc/rust-playground-ci-tool-${{ matrix.tool }}
129141
steps:
@@ -214,6 +226,7 @@ jobs:
214226
run_integration_tests:
215227
name: Running integration tests
216228
runs-on: ubuntu-latest
229+
if: 'contains(github.event.pull_request.labels.*.name, ''CI: approved'')'
217230
needs:
218231
- build_compiler_containers
219232
- build_tool_containers

.github/workflows/cron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
name: Scheduled rebuild
44
'on':
5-
workflow_dispatch:
5+
workflow_dispatch:
66
schedule:
77
- cron: 7 2 * * *
88
env:

ci/workflows.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,26 @@ workflows:
212212
push:
213213
branches:
214214
- master
215-
pull_request:
215+
pull_request_target:
216+
types: [labeled]
216217
branches:
217218
- master
218219

219220
<<: *global_env
220221

221222
jobs:
223+
debug:
224+
runs-on: ubuntu-latest
225+
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
226+
steps:
227+
- run: echo '${{ secrets.AWS_SECRET_ACCESS_KEY }}' | wc
228+
- run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | wc
229+
- run: echo '${{ secrets.GH_CONTAINER_REGISTRY_TOKEN }}' | wc
230+
- run: echo '${{ secrets.PLAYGROUND_GITHUB_TOKEN }}' | wc
231+
222232
build_compiler_containers:
223233
<<: *build_compiler_containers_job
234+
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
224235
env:
225236
<<: *build_compiler_containers_job_env
226237

@@ -236,6 +247,7 @@ workflows:
236247

237248
build_tool_containers:
238249
<<: *build_tool_containers_job
250+
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
239251
env:
240252
<<: *build_tool_containers_job_env
241253

@@ -336,6 +348,7 @@ workflows:
336348
run_integration_tests:
337349
name: "Running integration tests"
338350
runs-on: ubuntu-latest
351+
if: "contains(github.event.pull_request.labels.*.name, 'CI: approved')"
339352
needs:
340353
- build_compiler_containers
341354
- build_tool_containers

0 commit comments

Comments
 (0)