mirror of
https://github.com/mshick/add-pr-comment.git
synced 2025-12-31 14:20:32 +11:00
add custom owner and repo inputs (#78)
* add custom owner and repo inputs * add test for comment in another repo
This commit is contained in:
parent
7ca8398d28
commit
1605572889
6 changed files with 61 additions and 46 deletions
|
|
@ -16,6 +16,8 @@ const simpleMessage = 'hello world'
|
|||
type Inputs = {
|
||||
message: string | undefined
|
||||
'message-path': string | undefined
|
||||
'repo-owner': string
|
||||
'repo-name': string
|
||||
'repo-token': string
|
||||
'message-id': string
|
||||
'allow-repeats': string
|
||||
|
|
@ -29,6 +31,8 @@ type Inputs = {
|
|||
const defaultInputs: Inputs = {
|
||||
message: '',
|
||||
'message-path': undefined,
|
||||
'repo-owner': 'foo',
|
||||
'repo-name': 'bar',
|
||||
'repo-token': repoToken,
|
||||
'message-id': 'add-pr-comment',
|
||||
'allow-repeats': 'false',
|
||||
|
|
@ -175,6 +179,18 @@ describe('add-pr-comment action', () => {
|
|||
expect(core.setOutput).toHaveBeenCalledWith('comment-created', 'true')
|
||||
})
|
||||
|
||||
it('creates a comment in another repo', async () => {
|
||||
const repoOwner = 'my-owner'
|
||||
const repoName = 'my-repo'
|
||||
inputs['repo-owner'] = repoOwner
|
||||
inputs['repo-name'] = repoName
|
||||
repoFullName = `${repoOwner}/${repoName}`
|
||||
|
||||
await expect(run()).resolves.not.toThrow()
|
||||
expect(core.setOutput).toHaveBeenCalledWith('comment-created', 'true')
|
||||
expect(core.setOutput).toHaveBeenCalledWith('comment-id', postIssueCommentsResponse.id)
|
||||
})
|
||||
|
||||
it('safely exits when no issue can be found [using GITHUB_TOKEN in env]', async () => {
|
||||
process.env['GITHUB_TOKEN'] = repoToken
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue