Skip to content

Commit 2b1df81

Browse files
committed
revert changes here
1 parent b5fd666 commit 2b1df81

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

.github/workflows/preview.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,55 @@ name: Deploy PR previews
22

33
on:
44
pull_request_target:
5+
types:
6+
- opened
7+
- reopened
8+
- labeled
9+
- synchronize
510
branches:
611
- main
712

13+
paths:
14+
- "content/**"
15+
- "static/**"
16+
- "styles/**"
17+
- "syntaxes/**"
18+
- "templates/**"
19+
- "themes/**"
20+
821
env:
9-
DEPLOY_REPO_OWNER: harryob
10-
DEPLOY_REPO: od-ref-preview
22+
DEPLOY_REPO_OWNER: OpenDreamProject
23+
DEPLOY_REPO: od-dm-reference
1124

12-
concurrency: preview-${{ github.ref }}
25+
concurrency:
26+
group: "ci-security-${{ github.head_ref || github.run_id }}-${{ github.event_name }}"
27+
cancel-in-progress: true
1328

1429
jobs:
30+
security-checkpoint:
31+
name: Check CI Clearance
32+
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'
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: "Add 'CI Approval Required' Label"
36+
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'))
37+
uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf
38+
with:
39+
labels: CI Approval Required
40+
41+
- name: Fail if PR has Unlabeled new Commits from User
42+
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'))
43+
run: exit 1
44+
1545
deploy-preview:
16-
runs-on: ubuntu-20.04
46+
needs: security-checkpoint
47+
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)))
48+
runs-on: ubuntu-latest
1749
steps:
1850
- name: Checkout repo
1951
uses: actions/checkout@v4
2052
with:
21-
ref: ${{ github.event.pull_request.head.sha }}
22-
23-
- name: Configure Base Directory
24-
run: sed -i 's/base_url = ".*"/base_url = "https:\/\/${{ env.DEPLOY_REPO_OWNER }}.github.io\/${{ env.DEPLOY_REPO }}\/pr-${{ github.event.number }}"/' config.toml
53+
ref: refs/pull/${{ github.event.number }}/merge
2554

2655
- name: Setup Node
2756
uses: actions/setup-node@v4
@@ -41,12 +70,18 @@ jobs:
4170
version: "1.6.0"
4271

4372
- name: Build project
44-
run: npm run build:index
73+
run: npm run build -- -u "https://ref.opendre.am/pr-preview/pr-${{ github.event.number }}"
74+
75+
- name: Build index
76+
run: |
77+
npm run build:search-config -- -u "https://ref.opendre.am/pr-preview/pr-${{ github.event.number }}"
78+
npm run build:search-index
4579
4680
- name: Deploy preview
4781
uses: rossjrw/pr-preview-action@v1
4882
with:
4983
source-dir: ./public/
50-
umbrella-dir: .
84+
umbrella-dir: ./pr-preview/
5185
deploy-repository: ${{ env.DEPLOY_REPO_OWNER }}/${{ env.DEPLOY_REPO }}
52-
token: ${{ secrets.PREVIEW_TOKEN }}
86+
custom-url: "ref.opendre.am"
87+
action: deploy

0 commit comments

Comments
 (0)