From 48cea4ad9b1bf3ea40e2ac5c8465639f9f08565c Mon Sep 17 00:00:00 2001 From: LordGrey <48840279+Lord-Grey@users.noreply.github.com> Date: Sat, 30 Sep 2023 18:00:38 +0200 Subject: [PATCH] Focus on relevant PRs --- bin/scripts/install_pr.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/scripts/install_pr.sh b/bin/scripts/install_pr.sh index 8549f797..bab790a0 100755 --- a/bin/scripts/install_pr.sh +++ b/bin/scripts/install_pr.sh @@ -93,7 +93,7 @@ else fi # Determine if PR number exists -pulls=$(request_call "$api_url/pulls") +pulls=$(request_call "$api_url/pulls?state=open") pr_exists=$(echo "$pulls" | tr '\r\n' ' ' | ${pythonCmd} -c """ import json,sys @@ -106,7 +106,7 @@ for i in data: """ 2>/dev/null) if [ "$pr_exists" != "exists" ]; then - echo "---> Pull Request $pr_number not found -> abort" + echo "---> Pull Request $pr_number not found as open PR -> abort" exit 1 fi @@ -122,7 +122,7 @@ for i in data: """ 2>/dev/null) if [ -z "$head_sha" ]; then - echo "---> The specified PR #$pr_number has no longer any artifacts." + echo "---> The specified PR #$pr_number has no longer any artifacts or has been closed." echo "---> It may be older than 14 days. Ask the PR creator to recreate the artifacts at the following URL:" echo "---> https://github.com/hyperion-project/hyperion.ng/pull/$pr_number" exit 1 @@ -130,13 +130,13 @@ fi if [ -z "$run_id" ]; then # Determine run_id from head_sha -runs=$(request_call "$api_url/actions/runs") +runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha") run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """ import json,sys data = json.load(sys.stdin) for i in data['workflow_runs']: - if i['head_sha'] == '"$head_sha"' and i['name'] == 'Hyperion PR Build': + if i['name'] == 'Hyperion PR Build': print(i['id']) break """ 2>/dev/null)