Skip to content

Commit d533d27

Browse files
committed
✨ run prettier
1 parent 3a6c65c commit d533d27

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ branding:
55
icon: "crosshair"
66
color: "orange"
77
runs:
8-
using: 'docker'
9-
image: 'Dockerfile'
8+
using: "docker"
9+
image: "Dockerfile"

src/entrypoint.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ const { Toolkit } = require("actions-toolkit")
33
const getComments = require("./get-comments")
44

55
const tools = new Toolkit()
6-
const argv = process.argv.slice(2)
7-
// const arguments = tools.arguments
86

97
const me = "github-actions[bot]"
108

11-
const [ reportFilePath ] = argv
9+
const [, , reportFilePath] = process.argv
1210
const { event, payload, sha } = tools.context
1311

1412
async function run() {
@@ -23,11 +21,13 @@ async function run() {
2321
report = await readFile(reportFilePath, { encoding: "utf8" })
2422
} catch {
2523
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+
)
2727
report = error
2828
}
2929

30-
const {issues} = tools.github
30+
const { issues } = tools.github
3131

3232
// add comment on PR
3333
const { owner, repo } = tools.context.repo
@@ -37,19 +37,21 @@ async function run() {
3737

3838
const commentParams = {
3939
...params,
40-
issue_number: pr
41-
? pr.number
42-
: tools.context.issue.number
40+
issue_number: pr ? pr.number : tools.context.issue.number
4341
}
4442

4543
try {
4644
const myComments = await getComments(issues, commentParams, me)
4745

4846
// 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+
)
5355

5456
await issues.createComment({
5557
...commentParams,

src/get-comments.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ module.exports = async function getComments(issues, params, ofUser) {
55

66
let page = 0
77
while (true) {
8-
const nextComments = (await issues.listComments({
9-
...params,
10-
per_page: PER_PAGE,
11-
page
12-
})).data
8+
const nextComments = (
9+
await issues.listComments({
10+
...params,
11+
per_page: PER_PAGE,
12+
page
13+
})
14+
).data
1315

1416
if (ofUser === undefined) {
1517
myComments.push(...nextComments)

0 commit comments

Comments
 (0)