Skip to content

Skip deployment for Dependabot pull requests (#8) #9

Skip deployment for Dependabot pull requests (#8)

Skip deployment for Dependabot pull requests (#8) #9

name: Deploy dashboard
on:
push:
branches: [main]
paths:
- 'dashboard/**'
- '.github/workflows/deploy-dashboard.yml'
pull_request:
paths:
- 'dashboard/**'
- '.github/workflows/deploy-dashboard.yml'
permissions:
contents: read
jobs:
deploy:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
environment:
name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }}
url: ${{ steps.deploy.outputs.deployment-url }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '20'
cache: npm
cache-dependency-path: dashboard/package-lock.json
- name: Install dependencies
working-directory: dashboard
run: npm ci
- name: Install wrangler
run: npm install -g wrangler@^4
- name: Build
working-directory: dashboard
run: npm run build
- name: Deploy to Cloudflare Pages
id: deploy
working-directory: dashboard
run: |
OUTPUT=$(wrangler pages deploy \
${{ github.ref != 'refs/heads/main' && format('--branch {0}', github.head_ref || github.ref_name) || '' }})
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'https://[^\s]+\.pages\.dev[^\s]*' | tail -1)
echo "deployment-url=${URL}" >> "$GITHUB_OUTPUT"
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}