Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit be02218

Browse files
authoredMar 26, 2021
Merge pull request #2981 from cdr/jsjoeio/fix-get-artifact-url
refactor: change get_artifacts_url in lib.sh
2 parents f55f79f + f27c039 commit be02218

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎ci/lib.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,16 @@ curl() {
5757
# This will contain the artifacts we want.
5858
# https://developer.github.com/v3/actions/workflow-runs/#list-workflow-runs
5959
get_artifacts_url() {
60-
local head_sha
6160
local artifacts_url
62-
head_sha=$(git rev-parse HEAD)
63-
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)
61+
local workflow_runs_url="https://api.github.com/repos/cdr/code-server/actions/workflows/ci.yaml/runs?status=success&event=pull_request"
62+
# For releases, we look for run based on the branch name v$code_server_version
63+
# example: v3.9.2
64+
local version_branch="v$VERSION"
65+
artifacts_url=$(curl -fsSL "$workflow_runs_url" | jq -r ".workflow_runs[] | select(.head_branch == \"$version_branch\") | .artifacts_url" | head -n 1)
6466
if [[ -z "$artifacts_url" ]]; then
6567
echo >&2 "ERROR: artifacts_url came back empty"
66-
echo >&2 "Check the get_artifacts_url function"
68+
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"
69+
echo >&2 "URL used for curl call: $workflow_runs_url"
6770
exit 1
6871
fi
6972

0 commit comments

Comments
 (0)
Please sign in to comment.