Prettify workflow file

This commit is contained in:
David Baker 2022-12-21 12:01:06 +00:00
parent 39e92b9e2e
commit 1442e57a23

View file

@ -1,68 +1,68 @@
name: Netlify PR Preview name: Netlify PR Preview
on: on:
workflow_run: workflow_run:
workflows: ["Build"] workflows: ["Build"]
types: types:
- completed - completed
jobs: jobs:
deploy: deploy:
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: Netlify environment: Netlify
steps: steps:
- name: 📝 Create Deployment - name: 📝 Create Deployment
uses: bobheadxi/deployments@v1 uses: bobheadxi/deployments@v1
id: deployment id: deployment
with: with:
step: start step: start
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
env: Netlify env: Netlify
ref: ${{ github.event.workflow_run.head_sha }} ref: ${{ github.event.workflow_run.head_sha }}
desc: | desc: |
Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Do you trust the author of this PR? Maybe this build will steal your keys or give you malware.
Exercise caution. Use test accounts. Exercise caution. Use test accounts.
- id: prdetails - id: prdetails
uses: matrix-org/pr-details-action@v1.2 uses: matrix-org/pr-details-action@v1.2
with: with:
owner: ${{ github.event.workflow_run.head_repository.owner.login }} owner: ${{ github.event.workflow_run.head_repository.owner.login }}
branch: ${{ github.event.workflow_run.head_branch }} branch: ${{ github.event.workflow_run.head_branch }}
# There's a 'download artifact' action, but it hasn't been updated for the workflow_run action # There's a 'download artifact' action, but it hasn't been updated for the workflow_run action
# (https://github.com/actions/download-artifact/issues/60) so instead we get this mess: # (https://github.com/actions/download-artifact/issues/60) so instead we get this mess:
- name: 📥 Download artifact - name: 📥 Download artifact
uses: dawidd6/action-download-artifact@v2 uses: dawidd6/action-download-artifact@v2
with: with:
run_id: ${{ github.event.workflow_run.id }} run_id: ${{ github.event.workflow_run.id }}
name: previewbuild name: previewbuild
path: webapp path: webapp
- name: ☁️ Deploy to Netlify - name: ☁️ Deploy to Netlify
id: netlify id: netlify
uses: nwtgck/actions-netlify@v1.2 uses: nwtgck/actions-netlify@v1.2
with: with:
publish-dir: webapp publish-dir: webapp
deploy-message: "Deploy from GitHub Actions" deploy-message: "Deploy from GitHub Actions"
# These don't work because we're in workflow_run # These don't work because we're in workflow_run
enable-pull-request-comment: false enable-pull-request-comment: false
enable-commit-comment: false enable-commit-comment: false
alias: pr${{ steps.prdetails.outputs.pr_id }} alias: pr${{ steps.prdetails.outputs.pr_id }}
env: env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1 timeout-minutes: 1
- name: 🚦 Update deployment status - name: 🚦 Update deployment status
uses: bobheadxi/deployments@v1 uses: bobheadxi/deployments@v1
if: always() if: always()
with: with:
step: finish step: finish
override: false override: false
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }} status: ${{ job.status }}
env: ${{ steps.deployment.outputs.env }} env: ${{ steps.deployment.outputs.env }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }} deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ steps.netlify.outputs.deploy-url }} env_url: ${{ steps.netlify.outputs.deploy-url }}
desc: | desc: |
Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Do you trust the author of this PR? Maybe this build will steal your keys or give you malware.
Exercise caution. Use test accounts. Exercise caution. Use test accounts.