From 6ee6d751109645d6d618db72f3446d9fe69c3aa8 Mon Sep 17 00:00:00 2001 From: Peter Feerick Date: Thu, 20 Jun 2024 13:04:31 +1000 Subject: [PATCH] chore: comments and test if secrets available --- .github/workflows/pipeline.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 27d5635..8f15f2b 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -10,6 +10,8 @@ on: pull_request: jobs: + # This job is necessary as repo secrets are not availble in jobs run + # in pull requests from forks, thus preview-web will fail. check-permissions: runs-on: ubuntu-latest outputs: @@ -24,13 +26,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - action-debug: - needs: [check-permissions] - runs-on: ubuntu-latest - steps: - - run: | - echo ${{ needs.check-permissions.outputs.checkout-priv }} - lint: runs-on: ubuntu-latest @@ -170,8 +165,8 @@ jobs: os: [macos-latest, ubuntu-20.04, windows-latest] steps: - - name: Checkout using PR head - if: ${{ needs.check-permissions.outputs.checkout-priv == 'true' }} + - name: Checkout using PR head if sufficent permissions + if: ${{ github.event_name == 'pull_request' && needs.check-permissions.outputs.checkout-priv == 'true'}} uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -375,6 +370,15 @@ jobs: name: storybook-static path: build/renderer/storybook + - name: Check if secrets are available + run: | + if [[ "${{ secrets.MY_TEST_SECRET }}" == "xval" ]]; then + echo "Access to secrets" + else + echo "No access to secrets" + exit 1 + fi + - name: Deploy preview id: cloudflare-preview uses: cloudflare/wrangler-action@v3