matrix-org/pr-details-action

This commit is contained in:
fkwp
2024-04-12 19:21:59 +00:00
parent 89911c1747
commit b8aaa6b079

View File

@@ -9,27 +9,21 @@ jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
env:
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
PR_HEAD_FULL_NAME: ${{ github.event.workflow_run.head_repository.full_name }}
PR_HEAD_REF: ${{ github.event.workflow_run.pull_requests[0].head.ref }}
PR_HEAD_SHA: ${{ github.event.workflow_run.pull_requests[0].head.sha }}
runs-on: ubuntu-latest
permissions:
deployments: write
environment: Netlify
steps:
- name: "Get PR information"
uses: potiuk/get-workflow-origin@v1_3
id: pr-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
- id: prdetails
uses: matrix-org/pr-details-action@v1.3
continue-on-error: true
with:
owner: ${{ github.event.workflow_run.head_repository.owner.login }}
branch: ${{ github.event.workflow_run.head_branch }}
- name: Update env.PR_NUMBER if empty
run: |
if [ -z "$PR_NUMBER" ]; then
echo "PR_NUMBER=${{ steps.source-run-info.outputs.pullRequestNumber }}" >> $GITHUB_ENV
fi
steps.prdetails.outputs.data.head.ref
- run: ${{ tojson(github.event) }}
shell: cat {0}
@@ -41,7 +35,7 @@ jobs:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: Netlify
ref: ${{ env.PR_HEAD_SHA || github.ref || github.head_ref }}
ref: ${{ steps.prdetails.outputs.data.head.sha || github.ref || github.head_ref }}
desc: |
Do you trust the author of this PR? Maybe this build will steal your keys or give you malware.
Exercise caution. Use test accounts.
@@ -59,7 +53,7 @@ jobs:
run: curl -s https://raw.githubusercontent.com/element-hq/element-call/main/config/netlify_redirects > webapp/_redirects
- name: Add config file
run: curl -s "https://raw.githubusercontent.com/${{ env.PR_HEAD_FULL_NAME }}/${{ env.PR_HEAD_REF }}/config/element_io_preview.json" > webapp/config.json
run: curl -s "https://raw.githubusercontent.com/${{ env.PR_HEAD_FULL_NAME }}/${{ steps.prdetails.outputs.data.head.ref }}/config/element_io_preview.json" > webapp/config.json
- name: ☁️ Deploy to Netlify
id: netlify
@@ -67,7 +61,7 @@ jobs:
with:
publish-dir: webapp
deploy-message: "Deploy from GitHub Actions"
alias: pr${{ env.PR_NUMBER }}
alias: pr${{ steps.prdetails.outputs.pr_id }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}