Try wait-for-hydra action (#105)

* Update main.yml

* Update main.yml

* Update main.yml
This commit is contained in:
Moritz Angermann 2023-10-18 12:14:02 +08:00 committed by GitHub
parent cf203c4609
commit 523d0f296d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,30 +18,9 @@ jobs:
name: "Wait for hydra status"
runs-on: ubuntu-latest
steps:
- name: Get specific check run status
run: |
# start with a random sleep to prevent hitting the api too hard.
while true; do
# For GitHub Apps
# conclusion=$(gh api repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/status --jq '.check_runs[] | select(.name == "ci/hydra-build:$DEV_SHELL") | .conclusion')
# For GitHub Statuses; we need --paginate because there are so many statuses
echo "Querying: gh api repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/status --paginate --jq '.statuses[] | select(.context == \"$HYDRA_JOB\") | .state'"
conclusion=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/status" --paginate --jq ".statuses[] | select(.context == \"$HYDRA_JOB\") | .state")
case "$conclusion" in
success)
echo "$HYDRA_JOB succeeded"
exit 0;;
failure)
echo "$HYDRA_JOB failed"
exit 1;;
*)
echo "conclusion is: '$conclusion'"
gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/status" --paginate --jq '.statuses[] | .state+"\t"+.context'|sort
WAIT=$((30 + RANDOM % 30))
echo "$HYDRA_JOB pending. Waiting ${WAIT}s..."
sleep $WAIT;;
esac
done
- uses: input-output-hk/actions/wait-for-hydra@latest
with:
status: ci/hydra-build:required
upload:
needs: wait-for-hydra-eval
@ -106,4 +85,4 @@ jobs:
target-platform: ${{ matrix.target-platform }}
compiler-nix-name: ${{ matrix.compiler-nix-name }}
minimal: ${{ matrix.variant == '-minimal' }}
iog: ${{ matrix.iog == '-iog' }}
iog: ${{ matrix.iog == '-iog' }}