Focus on relevant PRs

This commit is contained in:
LordGrey 2023-09-30 18:00:38 +02:00 committed by GitHub
parent 7909997398
commit 48cea4ad9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,7 @@ else
fi fi
# Determine if PR number exists # 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 """ pr_exists=$(echo "$pulls" | tr '\r\n' ' ' | ${pythonCmd} -c """
import json,sys import json,sys
@ -106,7 +106,7 @@ for i in data:
""" 2>/dev/null) """ 2>/dev/null)
if [ "$pr_exists" != "exists" ]; then 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 exit 1
fi fi
@ -122,7 +122,7 @@ for i in data:
""" 2>/dev/null) """ 2>/dev/null)
if [ -z "$head_sha" ]; then 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 "---> 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" echo "---> https://github.com/hyperion-project/hyperion.ng/pull/$pr_number"
exit 1 exit 1
@ -130,13 +130,13 @@ fi
if [ -z "$run_id" ]; then if [ -z "$run_id" ]; then
# Determine run_id from head_sha # 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 """ run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """
import json,sys import json,sys
data = json.load(sys.stdin) data = json.load(sys.stdin)
for i in data['workflow_runs']: 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']) print(i['id'])
break break
""" 2>/dev/null) """ 2>/dev/null)