From 6d209bce1cc95959a518df4fab974a30c38726c5 Mon Sep 17 00:00:00 2001 From: JonJagger Date: Thu, 17 Oct 2024 09:33:25 +0100 Subject: [PATCH 1/5] Check branch expression --- .github/workflows/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a110c00..e59f5b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,10 +41,18 @@ jobs: name: ${{ steps.variables.outputs.name }} fingerprint: ${{ steps.variables.outputs.fingerprint }} steps: + - name: check branch condition before checkout + run: | + echo ":${{ github.ref }}:" + - uses: actions/checkout@v4 with: fetch-depth: 1 + - name: check branch condition after checkout + run: | + echo ":${{ github.ref }}:" + - name: Do wibble id: wibble run: | From 96cf3fb973593baed485a684f220ec0c347ec537 Mon Sep 17 00:00:00 2001 From: JonJagger Date: Thu, 17 Oct 2024 09:35:45 +0100 Subject: [PATCH 2/5] Try parenthesizing expression --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e59f5b9..6cea16e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,14 +61,14 @@ jobs: exit 0 - name: Setup Kosli cli - if: ${{ github.ref }} == 'refs/heads/main' && (success() || failure()) + if: (${{ github.ref }} == 'refs/heads/main') && (success() || failure()) uses: kosli-dev/setup-cli-action@v2 with: version: ${{ env.KOSLI_CLI_VERSION }} - name: When on master, attest result to Kosli - if: ${{ github.ref }} == 'refs/heads/main' && (success() || failure()) + if: (${{ github.ref }} == 'refs/heads/main') && (success() || failure()) run: | echo "KOSLI_DRY_RUN=:${KOSLI_DRY_RUN}:" KOSLI_COMPLIANT=$([ "${{ steps.wibble.outcome }}" == 'success' ] && echo true || echo false) From 3b027249e49a0234821200074ae864b25625d0cb Mon Sep 17 00:00:00 2001 From: JonJagger Date: Thu, 17 Oct 2024 09:39:00 +0100 Subject: [PATCH 3/5] Try moving closing brackets to end of expression --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6cea16e..5d35b32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,14 +61,14 @@ jobs: exit 0 - name: Setup Kosli cli - if: (${{ github.ref }} == 'refs/heads/main') && (success() || failure()) + if: ${{ github.ref == 'refs/heads/main') && (success() || failure()) }} uses: kosli-dev/setup-cli-action@v2 with: version: ${{ env.KOSLI_CLI_VERSION }} - name: When on master, attest result to Kosli - if: (${{ github.ref }} == 'refs/heads/main') && (success() || failure()) + if: ${{ github.ref == 'refs/heads/main') && (success() || failure()) }} run: | echo "KOSLI_DRY_RUN=:${KOSLI_DRY_RUN}:" KOSLI_COMPLIANT=$([ "${{ steps.wibble.outcome }}" == 'success' ] && echo true || echo false) From e42c5cfcbc74374e4ea7d181124ae86aa94ce4f7 Mon Sep 17 00:00:00 2001 From: JonJagger Date: Thu, 17 Oct 2024 09:39:49 +0100 Subject: [PATCH 4/5] Remove extra parentheses --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d35b32..fe618e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,14 +61,14 @@ jobs: exit 0 - name: Setup Kosli cli - if: ${{ github.ref == 'refs/heads/main') && (success() || failure()) }} + if: ${{ github.ref == 'refs/heads/main' && (success() || failure()) }} uses: kosli-dev/setup-cli-action@v2 with: version: ${{ env.KOSLI_CLI_VERSION }} - name: When on master, attest result to Kosli - if: ${{ github.ref == 'refs/heads/main') && (success() || failure()) }} + if: ${{ github.ref == 'refs/heads/main' && (success() || failure()) }} run: | echo "KOSLI_DRY_RUN=:${KOSLI_DRY_RUN}:" KOSLI_COMPLIANT=$([ "${{ steps.wibble.outcome }}" == 'success' ] && echo true || echo false) From 65c036275c0bc44cec11d78482161196e2152182 Mon Sep 17 00:00:00 2001 From: JonJagger Date: Thu, 17 Oct 2024 09:40:54 +0100 Subject: [PATCH 5/5] Force job step to fail --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe618e0..50b6938 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,7 +58,7 @@ jobs: run: | echo "IMAGE_TAG=:${IMAGE_TAG}:" echo "IMAGE_NAME=:${IMAGE_NAME}:" - exit 0 + exit 23 - name: Setup Kosli cli if: ${{ github.ref == 'refs/heads/main' && (success() || failure()) }}