Skip deployment for Dependabot pull requests (#8) #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |