@@ -24,30 +24,28 @@ def SetGithubStatus(githubToken, context, targetUrl, desc, status, repoOwner, re
2424 """
2525}
2626
27- def WaitForGithubAction (githubToken , repoOwner , repoName , gitHash , actionName )
27+ def CheckNightlyTag (githubToken , repoOwner , repoName , expectedHash )
2828{
2929 def maxAttempts = 30 // 5 minutes with 10-second intervals
3030 def attempt = 0
3131
3232 while (attempt < maxAttempts) {
33- def status = bash("""
33+ def tagHash = bash("""
3434 curl -s \\
3535 -H "Authorization: Bearer ${ githubToken} " \\
36- "https://api.github.com/repos/${ repoOwner} /${ repoName} /commits/ ${ gitHash } /status " |
37- jq -r '.statuses[] | select(.context == " ${ actionName } ") | .state '
36+ "https://api.github.com/repos/${ repoOwner} /${ repoName} /git/refs/tags/nightly " |
37+ jq -r '.object.sha '
3838 """ , true ). trim()
39- // """
40- if (status == " success " ) {
39+
40+ if (tagHash == expectedHash ) {
4141 return true
42- } else if (status == " failure" || status == " error" ) {
43- error " GitHub Action ${ actionName} failed"
4442 }
4543
4644 sleep 10
4745 attempt++
4846 }
4947
50- error " Timeout waiting for GitHub Action ${ actionName } to complete "
48+ error " Timeout waiting for nightly tag to point to commit ${ expectedHash } "
5149}
5250
5351def UploadArtifactToGithub (githubToken , repoOwner , repoName , tagName , artifactPath , artifactName )
@@ -409,8 +407,8 @@ pipeline
409407 {
410408 withCredentials([string(credentialsId : ' github-token' , variable : ' GITHUB_TOKEN' )])
411409 {
412- // Wait for GitHub Action to create/update the nightly tag
413- WaitForGithubAction (' $GITHUB_TOKEN' , REPO_OWNER , REPO_NAME , GIT_HASH , " nightly-tag " )
410+ // Wait for nightly tag to be updated to the correct commit
411+ CheckNightlyTag (' $GITHUB_TOKEN' , REPO_OWNER , REPO_NAME , GIT_HASH )
414412
415413 // Upload Linux executable
416414 unstash ' linux_build'
0 commit comments