Skip to content

Commit

Permalink
Update waitForPRChecks handling (#24)
Browse files Browse the repository at this point in the history
* wait a bit to test PR action

* Update github.js to handle empty checks in waitForPRs
  • Loading branch information
extremeheat committed Apr 24, 2024
1 parent 2d00e80 commit 836333c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/github.js
Expand Up @@ -404,10 +404,13 @@ function mod (githubContext, githubToken) {
do {
checks = await getPullRequestChecks(number)
if (checks.length) {
const pending = checks.filter(check => check.status === 'in_progress')
const pending = checks.filter(check => check.status !== 'completed')
if (!pending.length) {
return checks
}
} else {
// No checks, nothing to wait for
return []
}
await new Promise(resolve => setTimeout(resolve, 10000))
} while (Date.now() - start < maxWait)
Expand Down
4 changes: 2 additions & 2 deletions test/basic.test.js
Expand Up @@ -39,7 +39,7 @@ describe('basic usage', () => {
console.log('Artifact written', ret)

// wait a few seconds
await new Promise(resolve => setTimeout(resolve, 2000))
await new Promise(resolve => setTimeout(resolve, 20 * 2000))
const newList = await github.artifacts.list()
console.log('List of Artifacts on Repo', newList)
assert(newList.length)
Expand All @@ -48,5 +48,5 @@ describe('basic usage', () => {
const downloaded = await github.artifacts.readTextArtifact(ret.id)
console.log('Read Artifact', downloaded)
assert(downloaded.fileA.includes('world'))
}).timeout(9000)
}).timeout(20 * 9000)
})

0 comments on commit 836333c

Please sign in to comment.