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: 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' }}
env: 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_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 runs-on: ubuntu-latest
permissions: permissions:
deployments: write deployments: write
environment: Netlify environment: Netlify
steps: steps:
- name: "Get PR information" - id: prdetails
uses: potiuk/get-workflow-origin@v1_3 uses: matrix-org/pr-details-action@v1.3
id: pr-info continue-on-error: true
with: with:
token: ${{ secrets.GITHUB_TOKEN }} owner: ${{ github.event.workflow_run.head_repository.owner.login }}
sourceRunId: ${{ github.event.workflow_run.id }} branch: ${{ github.event.workflow_run.head_branch }}
- name: Update env.PR_NUMBER if empty
run: | steps.prdetails.outputs.data.head.ref
if [ -z "$PR_NUMBER" ]; then
echo "PR_NUMBER=${{ steps.source-run-info.outputs.pullRequestNumber }}" >> $GITHUB_ENV
fi
- run: ${{ tojson(github.event) }} - run: ${{ tojson(github.event) }}
shell: cat {0} shell: cat {0}
@@ -41,7 +35,7 @@ jobs:
step: start step: start
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
env: Netlify 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: | 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.
@@ -59,7 +53,7 @@ jobs:
run: curl -s https://raw.githubusercontent.com/element-hq/element-call/main/config/netlify_redirects > webapp/_redirects run: curl -s https://raw.githubusercontent.com/element-hq/element-call/main/config/netlify_redirects > webapp/_redirects
- name: Add config file - 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 - name: ☁️ Deploy to Netlify
id: netlify id: netlify
@@ -67,7 +61,7 @@ jobs:
with: with:
publish-dir: webapp publish-dir: webapp
deploy-message: "Deploy from GitHub Actions" deploy-message: "Deploy from GitHub Actions"
alias: pr${{ env.PR_NUMBER }} 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 }}