From de4761f57b1d97d6752dc93c1cf192e37908d1b0 Mon Sep 17 00:00:00 2001 From: bjornoleh <63544115+bjornoleh@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:01:28 +0100 Subject: [PATCH] build_loop.yml: handle the case where the dev branch reference is not found --- .github/workflows/build_loop.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_loop.yml b/.github/workflows/build_loop.yml index 66f3bf643..134d89ae8 100644 --- a/.github/workflows/build_loop.yml +++ b/.github/workflows/build_loop.yml @@ -72,10 +72,15 @@ jobs: SHA=$(curl -sS \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ https://api.github.com/repos/${{ env.UPSTREAM_REPO }}/git/refs \ - | jq -r '.[] | select(.ref == "refs/heads/dev" ) | .object.sha' \ + | jq -r '.[] | select(.ref == "refs/heads/dev" ) | .object.sha // empty' \ | tr -d '"' ); - + + if [ -z "$SHA" ]; then + echo "Error: SHA for 'dev' branch not found."; + exit 1; + fi + # Create alive branch based on LoopKit/LoopWorkspace:dev gh api \ --method POST \