Skip to content

chore(deps): update dependency prettier to v3.8.3 #90

chore(deps): update dependency prettier to v3.8.3

chore(deps): update dependency prettier to v3.8.3 #90

Workflow file for this run

name: preview
permissions:
contents: write
pull-requests: write
on:
pull_request:
branches: ['main']
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
# Install Nix
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
# Build
- name: Build
id: build
run: nix develop --command bash -c "npm i && npm run build"
# Deploy Preview to Cloudflare Workers
# Ref: https://zenn.dev/lalalatotoro/articles/b8fa632b53d332
# Ref: https://zenn.dev/nikomaru/articles/0cea1b1e2fd4f2
# Ref: https://developers.cloudflare.com/workers/wrangler/commands/#versions-upload
- name: Deploy Preview to Cloudflare Workers
id: preview
continue-on-error: true
uses: cloudflare/wrangler-action@v3
with:
wranglerVersion: "4.38.0"
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: |
versions upload --message "Deployed a Preview by GitHub Actions: branch ${{ github.ref_name }}"
- name: Create Preview Summary File (Success Pattern)
id: create-success-summary
env:
COMMIT_SHA: ${{ github.sha }}
COMMAND_OUTPUT: ${{ steps.preview.outputs.command-output }}
DEPLOYMENT_URL: ${{ steps.preview.outputs.deployment-url }}
if: ${{ steps.preview.outcome == 'success' }}
run: |
cat << EOF > preview-summary.md
# Deploying ${{ github.ref_name }} with 🚀 Cloudflare Workers
---
<table>
<tbody>
<tr>
<td>Latest commit:</td>
<td>${{ env.COMMIT_SHA }}</td>
</tr>
<tr>
<td>Status:</td>
<td>✅ Deploy successful!</td>
</tr>
<tr>
<td>Preview URL:</td>
<td><a target="_blank" rel="noopener noreferrer" href="${{ env.DEPLOYMENT_URL }}">${{ env.DEPLOYMENT_URL }}</a></td>
</tr>
</tbody>
</table>
<details>
<summary>View logs</summary>
${{ env.COMMAND_OUTPUT }}
</details>
EOF
- name: Create Preview Summary File (Failure Pattern)
id: create-failed-summary
env:
COMMIT_SHA: ${{ github.sha }}
if: ${{ steps.preview.outcome != 'success' }}
run: |
cat << EOF > preview-summary.md
# Deploying ${{ github.ref_name }} with 🚀 Cloudflare Workers
---
<table>
<tbody>
<tr>
<td>Latest commit:</td>
<td>${{ env.COMMIT_SHA }}</td>
</tr>
<tr>
<td>Status:</td>
<td>❌ Deploy failed...</td>
</tr>
<tr>
<td>Preview URL:</td>
<td>N/A</td>
</tr>
</tbody>
</table>
EOF
- name: Comment Preview Summary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.pull_request.number }} --body-file preview-summary.md
- name: Check Deploy Status
if: ${{ steps.preview.outcome != 'success' }}
run: |
echo "Deploy failed"
exit 1