chore: refactor GitHub Actions workflow for clarity and structure

- Updated workflow trigger to use a list format for better readability.
- Separated the deploy preview job into distinct steps for improved organization.
- Enhanced debug information to provide more detailed event context.
- Updated artifact download action to the latest version for better performance.
This commit is contained in:
Mauricio Siu 2025-03-16 11:14:43 -06:00
parent 7e9dda562b
commit 1bb88e7c93

View File

@ -2,7 +2,8 @@ name: Upload Preview Deployment
on: on:
workflow_run: workflow_run:
workflows: ['Build Preview Deployment'] workflows:
- "Build Preview Deployment"
types: types:
- completed - completed
@ -13,30 +14,31 @@ permissions:
pull-requests: write pull-requests: write
jobs: jobs:
deploy-preview: on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Debug Event
run: |
echo "Event name: ${{ github.event_name }}"
echo "Workflow name: ${{ github.event.workflow.name }}"
echo "Workflow run id: ${{ github.event.workflow_run.id }}"
echo "Workflow run number: ${{ github.event.workflow_run.run_number }}"
echo "Workflow run conclusion: ${{ github.event.workflow_run.conclusion }}"
echo "Workflow run event: ${{ github.event.workflow_run.event }}"
deploy-preview:
needs: on-success
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name == github.repository
name: Deploy Preview to Cloudflare Pages name: Deploy Preview to Cloudflare Pages
steps: steps:
- name: Debug Info
env:
EVENT_JSON: ${{ toJSON(github.event) }}
run: |
echo "Workflow Run ID: ${{ github.event.workflow_run.id }}"
echo "Event Type: ${{ github.event.workflow_run.event }}"
echo "Repository: ${{ github.event.workflow_run.head_repository.full_name }}"
echo "Full Event: $EVENT_JSON"
- name: Download artifacts - name: Download artifacts
uses: dawidd6/action-download-artifact@v3 uses: actions/download-artifact@v4
with: with:
workflow: Build Preview Deployment
run_id: ${{ github.event.workflow_run.id }}
name: preview-build name: preview-build
path: build path: build
search_artifacts: true github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: List files - name: List files
run: ls -la build run: ls -la build