@@ -11,23 +11,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
12
12
exports . cancelWorkflowRun = exports . getWorkflowRuns = exports . getWorkflowRunNumber = exports . getWorkflowRunCreatedAt = exports . getWorkflowId = exports . getWorkflowRun = void 0 ;
13
13
const 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 * ( ) {
15
15
return ( yield octokit . actions . getWorkflowRun ( {
16
16
owner : context . repo . owner ,
17
17
repo : context . repo . repo ,
18
18
'run_id' : Number ( process . env . GITHUB_RUN_ID ) ,
19
19
} ) ) . data ;
20
20
} ) ;
21
- exports . getWorkflowId = ( run ) => {
21
+ exports . getWorkflowRun = getWorkflowRun ;
22
+ const getWorkflowId = ( run ) => {
22
23
const matches = run . workflow_url . match ( / \d + $ / ) ;
23
24
if ( ! matches ) {
24
25
throw new Error ( 'Invalid workflow run' ) ;
25
26
}
26
27
return Number ( matches [ 0 ] ) ;
27
28
} ;
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 * ( ) {
31
35
const options = Object . assign ( Object . assign ( { } , context . repo ) , { 'workflow_id' : workflowId , status : 'in_progress' } ) ;
32
36
const branch = yield misc_1 . getTargetBranch ( octokit , context ) ;
33
37
logger . log ( 'target event: %s' , logger . c ( context . eventName , { color : 'green' } ) ) ;
@@ -42,7 +46,9 @@ exports.getWorkflowRuns = (workflowId, logger, octokit, context) => __awaiter(vo
42
46
// @ts -ignore
43
47
options ) ) . map ( run => run ) . filter ( run => run . event === context . eventName ) . filter ( misc_1 . isNotExcludeRun ) ;
44
48
} ) ;
49
+ exports . getWorkflowRuns = getWorkflowRuns ;
45
50
// 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 * ( ) {
47
52
return octokit . actions . cancelWorkflowRun ( Object . assign ( Object . assign ( { } , context . repo ) , { 'run_id' : runId } ) ) ;
48
53
} ) ;
54
+ exports . cancelWorkflowRun = cancelWorkflowRun ;
0 commit comments