@@ -11,23 +11,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1111Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1212exports . cancelWorkflowRun = exports . getWorkflowRuns = exports . getWorkflowRunNumber = exports . getWorkflowRunCreatedAt = exports . getWorkflowId = exports . getWorkflowRun = void 0 ;
1313const misc_1 = require ( "./misc" ) ;
14- exports . getWorkflowRun = ( octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
14+ const getWorkflowRun = ( octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
1515 return ( yield octokit . actions . getWorkflowRun ( {
1616 owner : context . repo . owner ,
1717 repo : context . repo . repo ,
1818 'run_id' : Number ( process . env . GITHUB_RUN_ID ) ,
1919 } ) ) . data ;
2020} ) ;
21- exports . getWorkflowId = ( run ) => {
21+ exports . getWorkflowRun = getWorkflowRun ;
22+ const getWorkflowId = ( run ) => {
2223 const matches = run . workflow_url . match ( / \d + $ / ) ;
2324 if ( ! matches ) {
2425 throw new Error ( 'Invalid workflow run' ) ;
2526 }
2627 return Number ( matches [ 0 ] ) ;
2728} ;
28- exports . getWorkflowRunCreatedAt = ( run ) => run . created_at ;
29- exports . getWorkflowRunNumber = ( run ) => run . run_number ;
30- exports . getWorkflowRuns = ( workflowId , logger , octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
29+ exports . getWorkflowId = getWorkflowId ;
30+ const getWorkflowRunCreatedAt = ( run ) => run . created_at ;
31+ exports . getWorkflowRunCreatedAt = getWorkflowRunCreatedAt ;
32+ const getWorkflowRunNumber = ( run ) => run . run_number ;
33+ exports . getWorkflowRunNumber = getWorkflowRunNumber ;
34+ const getWorkflowRuns = ( workflowId , logger , octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
3135 const options = Object . assign ( Object . assign ( { } , context . repo ) , { 'workflow_id' : workflowId , status : 'in_progress' } ) ;
3236 const branch = yield misc_1 . getTargetBranch ( octokit , context ) ;
3337 logger . log ( 'target event: %s' , logger . c ( context . eventName , { color : 'green' } ) ) ;
@@ -42,7 +46,9 @@ exports.getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(vo
4246 // @ts -ignore
4347 options ) ) . map ( run => run ) . filter ( run => run . event === context . eventName ) . filter ( misc_1 . isNotExcludeRun ) ;
4448} ) ;
49+ exports . getWorkflowRuns = getWorkflowRuns ;
4550// eslint-disable-next-line @typescript-eslint/no-explicit-any
46- exports . cancelWorkflowRun = ( runId , octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
51+ const cancelWorkflowRun = ( runId , octokit , context ) => __awaiter ( void 0 , void 0 , void 0 , function * ( ) {
4752 return octokit . actions . cancelWorkflowRun ( Object . assign ( Object . assign ( { } , context . repo ) , { 'run_id' : runId } ) ) ;
4853} ) ;
54+ exports . cancelWorkflowRun = cancelWorkflowRun ;
0 commit comments