From 2c5743e59828c1c43b401ece0d591d0de07fc658 Mon Sep 17 00:00:00 2001 From: Bart Smykla Date: Wed, 3 Apr 2024 18:04:15 +0200 Subject: [PATCH] ci(build-test-distribute): fix check of 'ci/force-push' label in PRs (#9808) When workflow was started as a result of `push` event, check was failing Signed-off-by: Bart Smykla --- .github/workflows/build-test-distribute.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-distribute.yaml b/.github/workflows/build-test-distribute.yaml index 02b6c0454600..6ccb7cb78f4a 100644 --- a/.github/workflows/build-test-distribute.yaml +++ b/.github/workflows/build-test-distribute.yaml @@ -28,6 +28,7 @@ jobs: FULL_MATRIX: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-full-matrix') }} ALLOW_PUSH: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/force-publish') }} BUILD: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ci/run-build') || contains(github.event.pull_request.labels.*.name, 'ci/force-publish') }} + FORCE_PUBLISH_FROM_FORK: ${{ github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ci/force-publish') && github.event.pull_request.head.repo.full_name != github.repository }} outputs: FULL_MATRIX: ${{ env.FULL_MATRIX }} ALLOW_PUSH: ${{ env.ALLOW_PUSH }} @@ -35,7 +36,7 @@ jobs: IMAGES: ${{ steps.metadata.outputs.images }} steps: - name: "Fail when 'ci/force-publish' label is present on PRs from forks" - if: ${{ fromJSON(env.ALLOW_PUSH) && github.event.pull_request.head.repo.full_name != github.repository }} + if: ${{ fromJSON(env.FORCE_PUBLISH_FROM_FORK) }} run: | echo "::error title=Label 'ci/force-publish' cannot be used on PRs from forks::To prevent accidental exposure of secrets, CI won't use repository secrets on pull requests from forks" exit 1