mirror of
https://git.tuxpa.in/a/code-server.git
synced 2024-12-28 13:15:25 +00:00
Merge pull request #2981 from cdr/jsjoeio/fix-get-artifact-url
refactor: change get_artifacts_url in lib.sh
This commit is contained in:
commit
be02218197
11
ci/lib.sh
11
ci/lib.sh
@ -57,13 +57,16 @@ curl() {
|
|||||||
# This will contain the artifacts we want.
|
# This will contain the artifacts we want.
|
||||||
# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
|
||||||
get_artifacts_url() {
|
get_artifacts_url() {
|
||||||
local head_sha
|
|
||||||
local artifacts_url
|
local artifacts_url
|
||||||
head_sha=$(git rev-parse HEAD)
|
local workflow_runs_url="https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=pull_request"
|
||||||
artifacts_url=$(curl -fsSL 'https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=pull_request' | jq -r ".workflow_runs[] | select(.head_sha == \"$head_sha\") | .artifacts_url" | head -n 1)
|
# For releases, we look for run based on the branch name v$code_server_version
|
||||||
|
# example: v3.9.2
|
||||||
|
local version_branch="v$VERSION"
|
||||||
|
artifacts_url=$(curl -fsSL "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1)
|
||||||
if [[ -z "$artifacts_url" ]]; then
|
if [[ -z "$artifacts_url" ]]; then
|
||||||
echo >&2 "ERROR: artifacts_url came back empty"
|
echo >&2 "ERROR: artifacts_url came back empty"
|
||||||
echo >&2 "Check the get_artifacts_url function"
|
echo >&2 "We looked for a successful run triggered by a pull_request with for code-server version: $code_server_version and a branch named $version_branch"
|
||||||
|
echo >&2 "URL used for curl call: $workflow_runs_url"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user