diff --git a/README.md b/README.md index 4782268..8a1b4fa 100644 --- a/README.md +++ b/README.md @@ -80,3 +80,6 @@ If you do end up adding this action in a non-PR context then it is designed to j **Required** Used to identify the test that has failed. Make sure that you are specific enough, which means that you probably should pass a matrix variable to this ID +### `bot-user` + +**Optional** This is only used if you have a custom bot user whos name is different from the default `github-actions[bot]`. This is an advanced feature and should be ignored by most users \ No newline at end of file diff --git a/action.yml b/action.yml index 9cefd30..7ce8439 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,10 @@ inputs: description: 'Identifier of the test' outcome: description: 'The outcome of the job' + bot-user: + description: 'The username for the bot that posts the comment' + required: false + default: 'github-actions[bot]' runs: using: 'node16' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 1cbf77d..15b9562 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9593,6 +9593,7 @@ if(_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.eventName !== 'pull_requ const myToken = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)('repo-token', { required: true }); const outcome = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)('outcome', { required: true }); const testId = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)('test-id', { required: true }); + const botUser = (0,_actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput)('bot-user', { required: true }); if (outcome === 'failure') { const octokit = (0,_actions_github__WEBPACK_IMPORTED_MODULE_1__.getOctokit)(myToken); @@ -9604,7 +9605,7 @@ if(_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.eventName !== 'pull_requ issue_number: pullRequest.number, }); - const existingComment = comments.find((comment) => comment.user.login === 'github-actions[bot]' && comment.body.endsWith(_lib_constants_js__WEBPACK_IMPORTED_MODULE_3__/* .signiture */ .o) && comment.body.includes(`sha: ${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.sha}`)); + const existingComment = comments.find((comment) => comment.user.login === botUser && comment.body.endsWith(_lib_constants_js__WEBPACK_IMPORTED_MODULE_3__/* .signiture */ .o) && comment.body.includes(`sha: ${_actions_github__WEBPACK_IMPORTED_MODULE_1__.context.sha}`)); if (existingComment) { diff --git a/index.js b/index.js index 60d1e0a..a2fb1c4 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,7 @@ if(context.eventName !== 'pull_request') { const myToken = getInput('repo-token', { required: true }); const outcome = getInput('outcome', { required: true }); const testId = getInput('test-id', { required: true }); + const botUser = getInput('bot-user', { required: true }); if (outcome === 'failure') { const octokit = getOctokit(myToken); @@ -23,7 +24,7 @@ if(context.eventName !== 'pull_request') { issue_number: pullRequest.number, }); - const existingComment = comments.find((comment) => comment.user.login === 'github-actions[bot]' && comment.body.endsWith(signiture) && comment.body.includes(`sha: ${context.sha}`)); + const existingComment = comments.find((comment) => comment.user.login === botUser && comment.body.endsWith(signiture) && comment.body.includes(`sha: ${context.sha}`)); if (existingComment) {