👷 Fix: preview alias and commit status (#2831)

This commit is contained in:
Ju4tCode 2024-07-21 12:40:50 +08:00 committed by GitHub
parent 53d8989145
commit 87e0d8148f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -43,9 +43,12 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }} run-id: ${{ github.event.workflow_run.id }}
- name: Restore Context and Set Deploy Name - name: Restore Context
run: | run: |
cat action.env >> $GITHUB_ENV cat action.env >> $GITHUB_ENV
- name: Set Deploy Name
run: |
echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV echo "DEPLOY_NAME=deploy-preview-${{ env.PR_NUMBER }}" >> $GITHUB_ENV
- name: Deploy to Netlify - name: Deploy to Netlify
@ -74,7 +77,7 @@ jobs:
if: always() if: always()
with: with:
script: | script: |
if (context.job.status === 'success') { if (`${{ job.status }}` === 'success') {
github.rest.repos.createCommitStatus({ github.rest.repos.createCommitStatus({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
@ -90,7 +93,7 @@ jobs:
repo: context.repo.repo, repo: context.repo.repo,
sha: context.payload.workflow_run.head_sha, sha: context.payload.workflow_run.head_sha,
context: 'Website Preview', context: 'Website Preview',
description: 'Deploy ' + context.job.status, description: `Deploy ${{ job.status }}`,
state: 'failure', state: 'failure',
}) })
} }