netlify.yaml: increased magic

pull/977/head
Richard van der Hoff 3 years ago
parent f5fcde09f8
commit d094a70d3a

@ -23,8 +23,16 @@ jobs:
- name: "🔍 Read PR number" - name: "🔍 Read PR number"
id: readctx id: readctx
# we need to find the PR number that corresponds to the branch, which we do by
# searching the GH API
run: | run: |
echo "::set-output name=prnumber::${{ github.event.workflow_run.pull_requests[0].number }}" head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}'
echo "head branch: $head_branch"
pr_number=$(curl -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
'https://api.github.com/repos/${{ github.repository }}/pulls?head=$head_branch' |
jq -r '.[] | .number')
echo "PR number: $pr_number"
echo "::set-output name=prnumber::$pr_number"
- name: '📥 Download artifact' - name: '📥 Download artifact'
uses: dawidd6/action-download-artifact@af92a8455a59214b7b932932f2662fdefbd78126 # v2.15.0 uses: dawidd6/action-download-artifact@af92a8455a59214b7b932932f2662fdefbd78126 # v2.15.0
@ -45,7 +53,7 @@ jobs:
deploy-message: "Deploy from GitHub Actions" deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: false enable-pull-request-comment: false
enable-commit-comment: false enable-commit-comment: false
alias: pr${{ github.event.workflow_run.pull_requests[0].number }} alias: pr${{ github.steps.readctx.outputs.prnumber }}
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 }}
@ -57,6 +65,6 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
pull-request-number: ${{ github.event.workflow_run.pull_requests[0].number }} pull-request-number: ${{ github.steps.readctx.outputs.prnumber }}
description-message: | description-message: |
Preview: ${{ steps.netlify.outputs.deploy-url }} Preview: ${{ steps.netlify.outputs.deploy-url }}

Loading…
Cancel
Save