Add update-only configuration option (#92)

This commit is contained in:
Alex Hatzenbuhler 2023-05-02 17:11:22 -05:00 committed by GitHub
parent 387ece43e3
commit 1dff58b1a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 3311 additions and 10787 deletions

View file

@ -24,6 +24,7 @@ type Inputs = {
'message-failure'?: string
'message-cancelled'?: string
'message-skipped'?: string
'update-only'?: string
status?: 'success' | 'failure' | 'cancelled' | 'skipped'
}
@ -175,6 +176,15 @@ describe('add-pr-comment action', () => {
expect(core.setOutput).toHaveBeenCalledWith('comment-created', 'true')
})
it('does not create a comment when updateOnly is true and no existing comment is found', async () => {
inputs.message = simpleMessage
inputs['allow-repeats'] = 'true'
inputs['update-only'] = 'true'
await expect(run()).resolves.not.toThrow()
expect(core.setOutput).toHaveBeenCalledWith('comment-created', 'false')
})
it('creates a comment in another repo', async () => {
inputs.message = simpleMessage
inputs['repo-owner'] = 'my-owner'