Skip to content

Commit 803cbfc

Browse files
committed
Corriger le rattrapage quand la branche n'existe pas
1 parent 5a1b4c0 commit 803cbfc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎.github/workflows/0-start-exercise.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ jobs:
9494
# Laisse à GitHub le temps d'enregistrer un événement déjà parti.
9595
sleep 2
9696
97-
head_sha="$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/heads/my-first-branch" --jq '.object.sha' 2>/dev/null || true)"
98-
if [ -n "$head_sha" ]; then
97+
if head_sha="$(gh api "repos/${GITHUB_REPOSITORY}/git/ref/heads/my-first-branch" --jq '.object.sha' 2>/dev/null)"; then
9998
run_count="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/1-create-a-branch.yml/runs?branch=my-first-branch&head_sha=$head_sha&per_page=1" --jq '.total_count')"
10099
if [ "$run_count" -eq 0 ]; then
101100
echo "La branche existe déjà : lancement immédiat de l'étape 1."
102101
gh workflow run 1-create-a-branch.yml --ref my-first-branch
103102
fi
103+
else
104+
echo "Aucune branche my-first-branch à rattraper."
104105
fi

0 commit comments

Comments
 (0)