Skip to content

Commit 7bb0d9d

Browse files
committed
Limit CI to authorized PRs only
1 parent b474a98 commit 7bb0d9d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/pr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,22 @@ on:
2020
- development
2121
- 'integ_[0-9]+\.[0-9]+'
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
27+
fail-if-unsafe:
28+
runs-on: ubuntu-latest
29+
if: ${{ !contains( github.event.pull_request.labels.*.name, 'safe-to-test') }}
30+
steps:
31+
- name: Fail if not marked as safe to test
32+
run: |
33+
echo "CI will not run on a PR unless it has the safe-to-test label applied"
34+
exit 1
2435
test-go:
2536
name: Lint & test Go code
2637
runs-on: [ self-hosted, Linux ]
38+
if: ${{ contains( github.event.pull_request.labels.*.name, 'safe-to-test') }}
2739
container:
2840
image: golang:1.24-alpine
2941

@@ -61,6 +73,7 @@ jobs:
6173
test-py:
6274
name: Lint & test Python code
6375
runs-on: [ self-hosted, Linux ]
76+
if: ${{ contains( github.event.pull_request.labels.*.name, 'safe-to-test') }}
6477
container:
6578
image: python:3.9.18
6679

0 commit comments

Comments
 (0)