@@ -3,12 +3,10 @@ const { Toolkit } = require("actions-toolkit")
3
3
const getComments = require ( "./get-comments" )
4
4
5
5
const tools = new Toolkit ( )
6
- const argv = process . argv . slice ( 2 )
7
- // const arguments = tools.arguments
8
6
9
7
const me = "github-actions[bot]"
10
8
11
- const [ reportFilePath ] = argv
9
+ const [ , , reportFilePath ] = process . argv
12
10
const { event, payload, sha } = tools . context
13
11
14
12
async function run ( ) {
@@ -23,11 +21,13 @@ async function run() {
23
21
report = await readFile ( reportFilePath , { encoding : "utf8" } )
24
22
} catch {
25
23
const error = "❌ Could not read report file"
26
- tools . log . error ( `${ error } from path at argv[0]: ${ reportFilePath } \nargv: ${ argv } ` )
24
+ tools . log . error (
25
+ `${ error } from path at argv[0]: ${ reportFilePath } \nargv: ${ argv } `
26
+ )
27
27
report = error
28
28
}
29
29
30
- const { issues} = tools . github
30
+ const { issues } = tools . github
31
31
32
32
// add comment on PR
33
33
const { owner, repo } = tools . context . repo
@@ -37,19 +37,21 @@ async function run() {
37
37
38
38
const commentParams = {
39
39
...params ,
40
- issue_number : pr
41
- ? pr . number
42
- : tools . context . issue . number
40
+ issue_number : pr ? pr . number : tools . context . issue . number
43
41
}
44
42
45
43
try {
46
44
const myComments = await getComments ( issues , commentParams , me )
47
45
48
46
// Delete old comments by this action
49
- await Promise . all ( myComments . map ( async ( { id } ) => issues . deleteComment ( {
50
- ...commentParams ,
51
- comment_id : id
52
- } ) ) )
47
+ await Promise . all (
48
+ myComments . map ( async ( { id } ) =>
49
+ issues . deleteComment ( {
50
+ ...commentParams ,
51
+ comment_id : id
52
+ } )
53
+ )
54
+ )
53
55
54
56
await issues . createComment ( {
55
57
...commentParams ,
0 commit comments