diff --git a/__tests__/add-pr-comment.test.ts b/__tests__/add-pr-comment.test.ts index 51f9aa4..f6a0279 100644 --- a/__tests__/add-pr-comment.test.ts +++ b/__tests__/add-pr-comment.test.ts @@ -29,7 +29,7 @@ type Inputs = { const defaultInputs: Inputs = { message: '', 'message-path': undefined, - 'repo-token': '', + 'repo-token': repoToken, 'message-id': 'add-pr-comment', 'allow-repeats': 'false', } @@ -130,7 +130,6 @@ describe('add-pr-comment action', () => { it('creates a comment with message text', async () => { inputs.message = simpleMessage - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'true' await expect(run()).resolves.not.toThrow() @@ -141,7 +140,6 @@ describe('add-pr-comment action', () => { it('creates a comment with a message-path', async () => { inputs.message = undefined inputs['message-path'] = path.resolve(__dirname, './message.txt') - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'true' await expect(run()).resolves.not.toThrow() @@ -152,18 +150,14 @@ describe('add-pr-comment action', () => { it('fails when both message and message-path are defined', async () => { inputs.message = 'foobar' inputs['message-path'] = path.resolve(__dirname, './message.txt') - inputs['repo-token'] = repoToken await expect(run()).resolves.not.toThrow() expect(core.setFailed).toHaveBeenCalledWith('must specify only one, message or message-path') }) it('creates a comment in an existing PR', async () => { - process.env['GITHUB_TOKEN'] = repoToken - inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'true' github.context.payload = { @@ -204,7 +198,6 @@ describe('add-pr-comment action', () => { it('creates a message when the message id does not exist', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' inputs['message-id'] = 'custom-id' @@ -224,7 +217,6 @@ describe('add-pr-comment action', () => { it('identifies an existing message by id and updates it', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' const commentId = 123 @@ -250,7 +242,6 @@ describe('add-pr-comment action', () => { it('overrides the default message with a success message on success', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' inputs['message-success'] = '666' inputs.status = 'success' @@ -273,7 +264,6 @@ describe('add-pr-comment action', () => { it('overrides the default message with a failure message on failure', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' inputs['message-failure'] = '666' inputs.status = 'failure' @@ -296,7 +286,6 @@ describe('add-pr-comment action', () => { it('overrides the default message with a cancelled message on cancelled', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' inputs['message-cancelled'] = '666' inputs.status = 'cancelled' @@ -319,7 +308,6 @@ describe('add-pr-comment action', () => { it('overrides the default message with a skipped message on skipped', async () => { inputs.message = simpleMessage inputs['message-path'] = undefined - inputs['repo-token'] = repoToken inputs['allow-repeats'] = 'false' inputs['message-skipped'] = '666' inputs.status = 'skipped' diff --git a/action.yml b/action.yml index c6d52e1..625a5b9 100644 --- a/action.yml +++ b/action.yml @@ -10,26 +10,26 @@ inputs: message-id: description: "An optional id to use for this message." default: "add-pr-comment" - required: false + required: true refresh-message-position: description: "If a message with the same id, this option allow to refresh the position of the message to be the last one posted." default: "false" - required: false + required: true repo-token: description: "A GitHub token for API access. Defaults to {{ github.token }}." default: "${{ github.token }}" - required: false + required: true allow-repeats: description: "Allow messages to be repeated." default: "false" - required: false + required: true proxy-url: description: "Proxy URL for comment creation" required: false status: description: "A job status for status headers. Defaults to {{ job.status }}." default: "${{ job.status }}" - required: false + required: true message-success: description: "Override the message when a run is successful." required: false