Do not refresh token on every request and cache verified ones #1049
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Preview Branch | |
on: | |
pull_request_target: | |
branches: | |
- staging | |
types: [opened, synchronize, reopened] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
permissions-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get User Permission | |
id: checkAccess | |
uses: actions-cool/check-user-permission@v2 | |
with: | |
require: write | |
username: ${{ github.triggering_actor }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check User Permission | |
if: steps.checkAccess.outputs.require-result == 'false' | |
run: | | |
echo "${{ github.triggering_actor }} does not have permissions on this repo." | |
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" | |
echo "Job originally triggered by ${{ github.actor }}" | |
exit 1 | |
call-test-api: | |
if: ${{ !failure() && !cancelled()}} | |
uses: ./.github/workflows/test-api.yml | |
needs: permissions-check | |
secrets: inherit | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
call-test-build: | |
if: ${{ !failure() && !cancelled() }} | |
uses: ./.github/workflows/test-build.yml | |
needs: permissions-check | |
secrets: inherit | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
netlify-context: deploy-preview | |
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }} | |
call-test: | |
if: ${{ !failure() && !cancelled() }} | |
uses: ./.github/workflows/test.yml | |
needs: call-test-build | |
secrets: inherit | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }} | |
call-test-playwright: | |
if: ${{ !failure() && !cancelled() }} | |
uses: ./.github/workflows/test-playwright.yml | |
needs: call-test-build | |
secrets: inherit | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }} | |
call-test-playwright-full: | |
if: ${{ !failure() && !cancelled() }} | |
uses: ./.github/workflows/test-playwright-full.yml | |
needs: permissions-check | |
secrets: inherit | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }} | |
call-deploy: | |
if: ${{ !failure() && !cancelled() }} | |
uses: ./.github/workflows/deploy.yml | |
needs: permissions-check | |
secrets: inherit | |
permissions: | |
pull-requests: write | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
environment: staging | |
netlify-context: deploy-preview | |
netlify-alias: pr-${{ github.event.pull_request.number }} | |
runner-label: ${{ vars.PREVIEW_RUNNER_LABEL }} |