@@ -55,30 +55,47 @@ module.exports = require("os");
55
55
56
56
"use strict" ;
57
57
58
+ var __awaiter = ( this && this . __awaiter ) || function ( thisArg , _arguments , P , generator ) {
59
+ function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
60
+ return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
61
+ function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
62
+ function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
63
+ function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
64
+ step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
65
+ } ) ;
66
+ } ;
58
67
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
68
+ const fs_1 = __webpack_require__ ( 747 ) ;
59
69
const path_1 = __webpack_require__ ( 622 ) ;
70
+ const util_1 = __webpack_require__ ( 669 ) ;
60
71
const core_1 = __webpack_require__ ( 470 ) ;
61
72
const command_1 = __webpack_require__ ( 431 ) ;
73
+ const readFileAsync = util_1 . promisify ( fs_1 . readFile ) ;
62
74
function run ( ) {
63
- try {
64
- const action = core_1 . getInput ( "action" ) ;
65
- switch ( action ) {
66
- case "add" :
67
- command_1 . issueCommand ( "add-matcher" , { } , __webpack_require__ . ab + "dotnet-format-problem-matcher.json" ) ;
68
- break ;
69
- case "remove" :
70
- command_1 . issueCommand ( "remove-matcher" , {
71
- owner : "dotnet-format" ,
72
- } , "" ) ;
73
- break ;
74
- default :
75
- throw Error ( `Unsupported action "${ action } "` ) ;
75
+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
76
+ try {
77
+ const action = core_1 . getInput ( "action" ) ;
78
+ const matcherFile = __webpack_require__ . ab + "problem-matcher.json" ;
79
+ switch ( action ) {
80
+ case "add" :
81
+ command_1 . issueCommand ( "add-matcher" , { } , __webpack_require__ . ab + "problem-matcher.json" ) ;
82
+ break ;
83
+ case "remove" :
84
+ const fileContents = yield readFileAsync ( __webpack_require__ . ab + "problem-matcher.json" , { encoding : "utf8" } ) ;
85
+ const problemMatcher = JSON . parse ( fileContents ) ;
86
+ command_1 . issueCommand ( "remove-matcher" , {
87
+ owner : problemMatcher . owner ,
88
+ } , "" ) ;
89
+ break ;
90
+ default :
91
+ throw Error ( `Unsupported action "${ action } "` ) ;
92
+ }
76
93
}
77
- }
78
- catch ( error ) {
79
- core_1 . setFailed ( error . message ) ;
80
- throw error ;
81
- }
94
+ catch ( error ) {
95
+ core_1 . setFailed ( error . message ) ;
96
+ throw error ;
97
+ }
98
+ } ) ;
82
99
}
83
100
exports . run = run ;
84
101
run ( ) ;
@@ -385,6 +402,20 @@ exports.getState = getState;
385
402
386
403
module . exports = require ( "path" ) ;
387
404
405
+ /***/ } ) ,
406
+
407
+ /***/ 669 :
408
+ /***/ ( function ( module ) {
409
+
410
+ module . exports = require ( "util" ) ;
411
+
412
+ /***/ } ) ,
413
+
414
+ /***/ 747 :
415
+ /***/ ( function ( module ) {
416
+
417
+ module . exports = require ( "fs" ) ;
418
+
388
419
/***/ } )
389
420
390
421
/******/ } ) ;
0 commit comments