Skip to content

Commit ca027e8

Browse files
committed
add comment upsert
1 parent a9f0a65 commit ca027e8

File tree

9 files changed

+5282
-97
lines changed

9 files changed

+5282
-97
lines changed

__tests__/main.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { run } from '../src/main'
77

88
// Mocking the @actions/core module
99
jest.mock('@actions/core')
10+
jest.mock('@actions/github')
1011

1112
const mockGet = jest.fn()
1213

@@ -17,6 +18,38 @@ jest.mock('@actions/http-client', () => {
1718
})
1819
}
1920
})
21+
jest.mock('@actions/github', () => {
22+
return {
23+
context: {
24+
repo: {
25+
owner: 'test-owner',
26+
repo: 'test-repo'
27+
},
28+
issue: {
29+
number: 1
30+
},
31+
sha: 'test-sha'
32+
},
33+
getOctokit: jest.fn().mockImplementation(() => {
34+
return {
35+
rest: {
36+
issues: {
37+
createComment: jest.fn(),
38+
updateComment: jest.fn(),
39+
listComments: jest.fn().mockResolvedValue({
40+
data: []
41+
})
42+
},
43+
repos: {
44+
listPullRequestsAssociatedWithCommit: jest.fn().mockResolvedValue({
45+
data: []
46+
})
47+
}
48+
}
49+
}
50+
})
51+
}
52+
})
2053

2154
describe('GitHub Actions Script', () => {
2255
let getInputMock: jest.Mock

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ inputs:
2525
apiKey:
2626
description: 'The API key for the Honeyhive API'
2727
required: true
28+
github_token:
29+
description: 'Your GitHub token'
30+
required: true
31+
default: ${{ github.token }}
32+
step_key:
33+
description:
34+
"A unique key to identify this step. Do not change this unless you know
35+
what you're doing."
36+
required: true
37+
default: ${{ github.workflow_ref }}-${{ github.action }}
2838

2939
outputs:
3040
status:

0 commit comments

Comments
 (0)