diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index adc5d18..64e160a 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -44,12 +44,20 @@ function build_runner() { forgejo-runner --version } +function get_status() { + local url="$1" + local repo="$2" + local sha="$3" + + forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status +} + function check_status() { local url="$1" local repo="$2" local sha="$3" - local state=$(forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status | jq --raw-output .state) + local state=$(get_status $url $repo $sha | jq --raw-output .state) echo $state test "$state" != "" -a "$state" != "pending" -a "$state" != "running" -a "$state" != "null" } @@ -67,8 +75,8 @@ function wait_success() { sleep $LOOP_DELAY done if ! test "$(check_status "$url" "$repo" "$sha")" = "success" ; then + get_status $url $repo $sha | jq .statuses test "$FORGEJO_RUNNER_LOGS" && cat $FORGEJO_RUNNER_LOGS - forgejo-curl.sh api_json $url/api/v1/repos/$repo/commits/$sha/status | jq . return 1 fi }