@@ -3,10 +3,12 @@ const github = require('@actions/github');
33const repoToken = core . getInput ( 'token' ) ;
44const client = github . getOctokit ( repoToken ) ;
55
6+ const check_retry_count = core . getInput ( 'check-retry-count' ) ;
7+ const check_retry_interval = core . getInput ( 'check-retry-interval' ) ;
8+
69// Function to wait for a specific commit status to become a success
7- async function waitForCommitStatusSuccess ( owner , repo , commitSha , statusContext , lookup , options = { } ) {
8- const { timeout = 300000 , retryCount = 10 , retryInterval = 5000 } = options ;
9- const startTime = Date . now ( ) ;
10+ async function waitForCommitStatus ( owner , repo , commitSha , statusContext , lookup , options = { } ) {
11+ const { retryCount = 10 , retryInterval = 5000 } = options ;
1012
1113 let attemptCount = 0 ;
1214
@@ -29,12 +31,6 @@ async function waitForCommitStatusSuccess(owner, repo, commitSha, statusContext,
2931
3032 attemptCount ++ ;
3133
32- const elapsedTime = Date . now ( ) - startTime ;
33- if ( elapsedTime >= timeout ) {
34- console . log ( `Timeout reached. Exiting...` ) ;
35- return false ;
36- }
37-
3834 console . log ( `Waiting for commit status "${ statusContext } " to become a success...` ) ;
3935
4036 await new Promise ( ( resolve ) => setTimeout ( resolve , retryInterval ) ) ;
@@ -49,20 +45,16 @@ const main = async function() {
4945 const sha = core . getInput ( 'sha' ) ;
5046 const status = core . getInput ( 'status' ) ;
5147 const expected_state = core . getInput ( 'expected_state' ) ;
52- const check_timeout = core . getInput ( 'check-timeout' ) ;
53- const check_retry_count = core . getInput ( 'check-retry-count' ) ;
54- const check_retry_interval = core . getInput ( 'check-retry-interval' ) ;
5548
5649 const options = {
57- timeout : 1000 * check_timeout , // Convert from seconds to milliseconds
5850 retryCount : check_retry_count , // Retry 5 times before giving up
5951 retryInterval : 1000 * check_retry_interval // Convert from seconds to milliseconds
6052 } ;
6153
6254 owner = repository . split ( "/" ) [ 0 ]
6355 repo = repository . split ( "/" ) [ 1 ]
6456
65- const test = await waitForCommitStatusSuccess ( owner , repo , sha , status , expected_state , options )
57+ const test = await waitForCommitStatus ( owner , repo , sha , status , expected_state , options )
6658 . then ( ( result ) => {
6759 console . log ( "Done waiting." ) ;
6860 if ( result ) {
0 commit comments