Skip to content

Commit 95b02c9

Browse files
committed
up
1 parent 31423bf commit 95b02c9

3 files changed

Lines changed: 74 additions & 3 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
branches:
9-
- main
107
jobs:
118
deploy:
129
permissions:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
# Trusted follow-up: runs in base-repo context so secrets and environments work (incl. fork PRs).
3+
# andykenward/github-actions-cloudflare-pages only supports push/pull_request/workflow_dispatch,
4+
# not workflow_run, so previews use wrangler directly (same pattern as Cloudflare docs).
5+
name: PR Preview Deploy
6+
on:
7+
workflow_run:
8+
workflows:
9+
- PR Preview Validate
10+
types:
11+
- completed
12+
13+
jobs:
14+
deploy:
15+
if: >-
16+
github.event.workflow_run.conclusion == 'success' &&
17+
github.event.workflow_run.event == 'pull_request'
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 5
20+
environment: Cloudflare Pages
21+
permissions:
22+
contents: read
23+
deployments: write
24+
pull-requests: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
with:
28+
repository: ${{ github.event.workflow_run.head_repository.full_name || github.repository }}
29+
ref: ${{ github.event.workflow_run.head_sha }}
30+
fetch-depth: 0
31+
- uses: actions/setup-python@v6
32+
with:
33+
python-version: 3.12
34+
cache: pip
35+
- name: Install dependencies
36+
run: pip install -r requirements.txt
37+
- name: Build docs
38+
run: mkdocs build
39+
- name: Deploy to Cloudflare Pages
40+
uses: andykenward/github-actions-cloudflare-pages@v3.0.0
41+
id: pages
42+
with:
43+
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
44+
cloudflare-account-id: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
45+
cloudflare-project-name: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
46+
directory: site
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
github-environment: Cloudflare Pages
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
# Runs without secrets (safe for fork PRs). PR Preview Deploy runs after this completes.
3+
name: PR Preview Validate
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 5
13+
permissions:
14+
contents: read
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-python@v6
20+
with:
21+
python-version: 3.12
22+
cache: 'pip'
23+
- name: pre-commit
24+
uses: pre-commit/action@v3.0.1
25+
with:
26+
extra_args: "--from-ref origin/main --to-ref HEAD"

0 commit comments

Comments
 (0)