mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-21 15:25:22 +03:00
fix preview checkout (#4468)
* fix preview checkout * coderabbit recommended issues: write permission * coderabbitAI implement security improvement * newline
This commit is contained in:
parent
9baef76904
commit
16c3b2ee4a
1 changed files with 29 additions and 7 deletions
36
.github/workflows/deploy-preview.yml
vendored
36
.github/workflows/deploy-preview.yml
vendored
|
@ -1,21 +1,20 @@
|
||||||
name: 'Preview Deployment'
|
name: 'Preview Deployment'
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request_target:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
# Job 1: Build the code (no secrets here)
|
||||||
permissions:
|
build:
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
pull-requests: write
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
persist-credentials: false # Don't persist GitHub token
|
||||||
|
|
||||||
- name: Cache node_modules
|
- name: Cache node_modules
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -32,6 +31,29 @@ jobs:
|
||||||
- run: yarn install
|
- run: yarn install
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
|
|
||||||
|
- name: Upload build artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist-files
|
||||||
|
path: src/dist
|
||||||
|
|
||||||
|
# Job 2: Deploy with secrets (no PR code checkout)
|
||||||
|
deploy:
|
||||||
|
needs: build # Wait for build job to complete
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
deployments: write
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download build artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist-files
|
||||||
|
path: src/dist
|
||||||
|
|
||||||
- name: Deploy to Cloudflare
|
- name: Deploy to Cloudflare
|
||||||
id: deploy
|
id: deploy
|
||||||
uses: cloudflare/wrangler-action@v3
|
uses: cloudflare/wrangler-action@v3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue