Skip to content

Commit e54344b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into bad-tag-desc
2 parents 69c4432 + 45d888a commit e54344b

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

.github/workflows/preview.yml

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,63 @@
11
name: Deploy PR previews
22

33
on:
4+
pull_request:
5+
branches:
6+
- main
47
pull_request_target:
8+
types:
9+
- opened
10+
- reopened
11+
- labeled
12+
- synchronize
513
branches:
614
- main
715

8-
paths:
9-
- "**/*.*"
10-
- "!package.json"
11-
- "!.github/workflows"
12-
1316
env:
1417
DEPLOY_REPO_OWNER: OpenDreamProject
1518
DEPLOY_REPO: od-dm-reference
1619

17-
concurrency: preview-${{ github.ref }}
20+
concurrency:
21+
group: "ci-security-${{ github.head_ref || github.run_id }}-${{ github.event_name }}"
22+
cancel-in-progress: true
1823

1924
jobs:
25+
security-checkpoint:
26+
name: Check CI Clearance
27+
if: github.event_name == 'pull_request_target' && (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id || github.event.pull_request.user.id == 55142896) && github.event.pull_request.state == 'open'
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: "Remove Stale 'CI Cleared' Label"
31+
if: github.event.action == 'synchronize' || github.event.action == 'reopened'
32+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0
33+
with:
34+
labels: CI Cleared
35+
36+
- name: "Remove 'CI Approval Required' Label"
37+
if: (github.event.action == 'synchronize' || github.event.action == 'reopened') || ((github.event.action == 'opened' || github.event.action == 'labeled') && contains(github.event.pull_request.labels.*.name, 'CI Cleared'))
38+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0
39+
with:
40+
labels: CI Approval Required
41+
42+
- name: "Add 'CI Approval Required' Label"
43+
if: (github.event.action == 'synchronize' || github.event.action == 'reopened') || ((github.event.action == 'opened' || github.event.action == 'labeled') && !contains(github.event.pull_request.labels.*.name, 'CI Cleared'))
44+
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf
45+
with:
46+
labels: CI Approval Required
47+
48+
- name: Fail if PR has Unlabeled new Commits from User
49+
if: (github.event.action == 'synchronize' || github.event.action == 'reopened') || ((github.event.action == 'opened' || github.event.action == 'labeled') && !contains(github.event.pull_request.labels.*.name, 'CI Cleared'))
50+
run: exit 1
51+
2052
deploy-preview:
53+
needs: security-checkpoint
54+
if: (!(cancelled() || failure()) && (needs.security-checkpoint.result == 'success' || (github.event_name != 'pull_request_target' && github.event.pull_request.head.repo.id == github.event.pull_request.base.repo.id && github.event.pull_request.user.id != 55142896)))
2155
runs-on: ubuntu-latest
2256
steps:
2357
- name: Checkout repo
2458
uses: actions/checkout@v4
59+
with:
60+
ref: refs/pull/${{ github.event.number }}/merge
2561

2662
- name: Setup Node
2763
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)