Fix broken netlify ci (#8427)

pull/28217/head
Michael Telatynski 2022-04-27 12:39:14 +01:00 committed by GitHub
parent 8f7e265125
commit 6d2230064e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 7 deletions

View File

@ -11,21 +11,19 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
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'
steps: steps:
- name: "🔍 Read PR details" - 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 # We need to find the PR number that corresponds to the branch, which we do by searching the GH API
# The workflow_run event includes a list of pull requests, but it doesn't get populated for # The workflow_run event includes a list of pull requests, but it doesn't get populated for
# forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run # forked PRs: https://docs.github.com/en/rest/reference/checks#create-a-check-run
run: | run: |
head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}' head_branch='${{github.event.workflow_run.head_repository.owner.login}}:${{github.event.workflow_run.head_branch}}'
echo "Head branch: $head_branch" echo "Head branch: $head_branch"
head_ref='${{github.event.workflow_run.head_sha}}'
echo "Head ref: $head_ref"
pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)" pulls_uri="https://api.github.com/repos/${{ github.repository }}/pulls?head=$(jq -Rr '@uri' <<<$head_branch)"
pr_number = $(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" | jq -r .[] | .number) pr_number=$(curl -s -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' "$pulls_uri" |
jq -r '.[] | .number')
echo "PR number: $pr_number" echo "PR number: $pr_number"
echo "::set-output name=prnumber::$pr_number" echo "::set-output name=prnumber::$pr_number"
echo "::set-output name=headref::$head_ref"
- name: Create Deployment ID - name: Create Deployment ID
uses: altinukshini/deployment-action@v1.2.6 uses: altinukshini/deployment-action@v1.2.6
@ -37,7 +35,7 @@ jobs:
transient_environment: true transient_environment: true
environment: Netlify environment: Netlify
initial_status: in_progress initial_status: in_progress
ref: ${{ steps.readctx.outputs.headref }} ref: ${{ github.event.workflow_run.head_sha }}
# There's a 'download artifact' action but it hasn't been updated for the # 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) # workflow_run action (https://github.com/actions/download-artifact/issues/60)