From 71cae7e5434be7ee4e009343885c2c855c9d416b Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Wed, 18 Sep 2024 11:49:33 -0400 Subject: [PATCH 1/2] Improve checking of previous test results The previous API command was limited to 20 results, and did not correctly evaluate to false when no workflow runs were found. Change-type: patch Signed-off-by: Kyle Harding --- .github/workflows/yocto-build-deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/yocto-build-deploy.yml b/.github/workflows/yocto-build-deploy.yml index 8a6a31a0d..bee3a9dee 100644 --- a/.github/workflows/yocto-build-deploy.yml +++ b/.github/workflows/yocto-build-deploy.yml @@ -307,7 +307,8 @@ jobs: # There will be "pull_request" and "pull_request_trigger" triggered workflow runs in the response - one will be skipped, one will be success/fail # So selecting for .conclusion==success will give us a response and evaluate to true in the following "if" statement if either we successful passed="false" - if gh api -H "Accept: application/vnd.github+json" /repos/$REPO/actions/runs --jq '.workflow_runs[] | select(.head_sha == "'"${head}"'") | select(.name == "'"${WORKFLOW_NAME}"'") | select(.conclusion == "success")'; then + conclusion="$(gh run list -w "${WORKFLOW_NAME}" -c "${head}" --json conclusion --jq '.[] | select(.conclusion == "success").conclusion')" + if [[ "${conclusion}" = "success" ]]; then passed="true" fi echo "finalize=${passed}" >> "$GITHUB_OUTPUT" From 8d17204120d75bfc6aba1f793163e7deb2008a1f Mon Sep 17 00:00:00 2001 From: rcooke-warwick Date: Thu, 19 Sep 2024 08:54:16 +0100 Subject: [PATCH 2/2] fix check of finalize value Change-type: patch Signed-off-by: Ryan Cooke --- .github/workflows/yocto-build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yocto-build-deploy.yml b/.github/workflows/yocto-build-deploy.yml index bee3a9dee..bf9bbeed1 100644 --- a/.github/workflows/yocto-build-deploy.yml +++ b/.github/workflows/yocto-build-deploy.yml @@ -533,7 +533,7 @@ jobs: # Separate this evaluation into its own step + output, as we use this logic in several places and its easier to manage this way - name: Evaluate whether to finalize release - if: steps.merge-test-result.outputs.finalize || inputs.force-finalize + if: steps.merge-test-result.outputs.finalize == 'true' || inputs.force-finalize id: should-finalize run: | echo "finalize=true" >> $GITHUB_OUTPUT