From 688bf4716cacbb6a7d122268153f08a068415f90 Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Tue, 23 Aug 2022 20:40:29 +0200 Subject: [PATCH] [INFRA] Remove the GH workflow checking secrets This was previously needed to test what we used for the surge preview. The decision whether to deploy to surge depended on secrets availability, but we don't do this anymore. --- ...cute-depending-on-secrets-availability.yml | 96 ------------------- 1 file changed, 96 deletions(-) delete mode 100644 .github/workflows/execute-depending-on-secrets-availability.yml diff --git a/.github/workflows/execute-depending-on-secrets-availability.yml b/.github/workflows/execute-depending-on-secrets-availability.yml deleted file mode 100644 index 34b3dfc..0000000 --- a/.github/workflows/execute-depending-on-secrets-availability.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Execute depending on secrets availability -on: - pull_request: - branches: - - master - -# on 2021-05-27, the 'if: ${{ secrets.GITHUB_TOKEN }}' syntax produced error, so use env variable as workaround -# error message: Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.GITHUB_TOKEN - -# Resources -# https://github.community/t/how-can-i-test-if-secrets-are-available-in-an-action/17911/5 - -jobs: - always_run: - runs-on: ubuntu-20.04 - steps: - - name: Message - run: echo "I always run!" - - name: Message only if GITHUB_TOKEN available - env: - SECRET: ${{ secrets.GITHUB_TOKEN }} - if: ${{ env.SECRET != '' }} - run: echo "GITHUB_TOKEN secret is available" - - name: Message only if GH_RELEASE_TOKEN available - env: - SECRET: ${{ secrets.GH_RELEASE_TOKEN }} - if: ${{ env.SECRET != '' }} - run: echo "GH_RELEASE_TOKEN secret is available" - - name: Message only if not existing secret available - env: - SECRET: ${{ secrets.TEST_UNAVAILABLE_SECRET }} - if: ${{ env.SECRET != '' }} - run: | - echo "not existing secret is available so failing!" - exit -1 - - -# inspired from https://github.com/GabLeRoux/github-actions-examples/blob/e0468ce2731b08bd8b1f7cd09d0b94c541310693/.github/workflows/secret_based_conditions.yml - checksecrets: - runs-on: ubuntu-20.04 - outputs: - is_GH_RELEASE_TOKEN_set: ${{ steps.secret_availability.outputs.is_GH_RELEASE_TOKEN_set }} - is_GITHUB_TOKEN_set: ${{ steps.secret_availability.outputs.is_GITHUB_TOKEN_set }} - is_TEST_UNAVAILABLE_SECRET_set: ${{ steps.secret_availability.outputs.is_TEST_UNAVAILABLE_SECRET_set }} - steps: - - name: Compute secrets availability - id: secret_availability - env: - SECRET_GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} - SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SECRET_TEST_UNAVAILABLE_SECRET: ${{ secrets.TEST_UNAVAILABLE_SECRET }} - run: | - echo "is_GH_RELEASE_TOKEN_set: ${{ env.SECRET_GH_RELEASE_TOKEN != '' }}" - echo "::set-output name=is_GH_RELEASE_TOKEN_set::${{ env.SECRET_GH_RELEASE_TOKEN != '' }}" - echo "is_GITHUB_TOKEN_set: ${{ env.SECRET_GITHUB_TOKEN != '' }}" - echo "::set-output name=is_GITHUB_TOKEN_set::${{ env.SECRET_GITHUB_TOKEN != '' }}" - echo "is_TEST_UNAVAILABLE_SECRET_set: ${{ env.TEST_UNAVAILABLE_SECRET != '' }}" - echo "::set-output name=is_TEST_UNAVAILABLE_SECRET_set::${{ env.TEST_UNAVAILABLE_SECRET != '' }}" - - display_secret_detection: - needs: [checksecrets] - runs-on: ubuntu-20.04 - steps: - - name: Display secrets check status - run: | - echo "is_GH_RELEASE_TOKEN_set ${{ needs.checksecrets.outputs.is_GH_RELEASE_TOKEN_set }}" - echo "is_GITHUB_TOKEN_set ${{ needs.checksecrets.outputs.is_GITHUB_TOKEN_set }}" - echo "is_TEST_UNAVAILABLE_SECRET_set ${{ needs.checksecrets.outputs.is_TEST_UNAVAILABLE_SECRET_set }}" - - - # This is skipped when triggered from forked repositories or involving Dependabot - run_if_special_secret_is_set: - needs: [checksecrets] - if: needs.checksecrets.outputs.is_GH_RELEASE_TOKEN_set == 'true' - runs-on: ubuntu-20.04 - steps: - - name: Message - run: echo "I have been triggered because the GH_RELEASE_TOKEN secret is available" - - # Should always run - run_if_gh_token_secret_is_set: - needs: [checksecrets] - if: needs.checksecrets.outputs.is_GITHUB_TOKEN_set == 'true' - runs-on: ubuntu-20.04 - steps: - - name: Message - run: echo "I have been triggered because the GITHUB_TOKEN secret is available" - - should_never_run_as_secret_is_not_available: - needs: [checksecrets] - if: needs.checksecrets.outputs.is_TEST_UNAVAILABLE_SECRET_set == 'true' - runs-on: ubuntu-20.04 - steps: - - run: | - echo "not existing secret is available so failing!" - exit -1