diff --git a/Readme.md b/Readme.md index 5d1fb81..a763117 100644 --- a/Readme.md +++ b/Readme.md @@ -29,7 +29,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: shanegenschaw/pull-request-comment-trigger@v2.1.0 + - uses: shanegenschaw/pull-request-comment-trigger@v2.2.0 id: check with: trigger: '@deploy' @@ -47,7 +47,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: shanegenschaw/pull-request-comment-trigger@v2.1.0 + - uses: shanegenschaw/pull-request-comment-trigger@v2.2.0 id: check with: trigger: '@deploy **' @@ -66,8 +66,7 @@ And if you specify a reaction, you have to provide the `GITHUB_TOKEN` env vbl. | Input | Required? | Description | | ----- | --------- | ----------- | -| trigger | Yes | The string to look for in pull-request descriptions and comments. For example "#build/android". | -| prefix_only | No (default 'false') | If 'true', the trigger must match the start of the comment. | +| trigger | Yes | The string to look for in pull-request descriptions and comments. The trigger should be placed at the beginning. For example "#build/android". | | reaction | No (default '') | If set, the specified emoji "reaction" is put on the comment to indicate that the trigger was detected. For example, "rocket". | | allow_arguments | No (default 'false') | If 'true', script looks for `**` markers that are considered as comment arguments. | diff --git a/action.yml b/action.yml index 84adb32..8eef2a3 100644 --- a/action.yml +++ b/action.yml @@ -8,10 +8,6 @@ inputs: trigger: description: 'The string to look for in pull-request descriptions and comments. For example "#build/android"' required: true - prefix_only: - description: If 'true', the trigger must match the start of the comment. - required: false - default: "false" allow_arguments: description: If 'true', the trigger can have arguments. Can be passed via "**". required: false diff --git a/dist/index.js b/dist/index.js index 14b2b4e..c47006a 100755 --- a/dist/index.js +++ b/dist/index.js @@ -15917,7 +15917,6 @@ async function run() { const { owner, repo } = context.repo; - const prefixOnly = core.getInput("prefix_only") === 'true'; const allowArguments = core.getInput("allow_arguments") === 'true'; let hasTrigger = body.startsWith(trigger); @@ -15925,18 +15924,14 @@ async function run() { if (allowArguments) { let regexRawTrigger = trigger.replace(/\s\*{2}/g, ' [^\\s]+'); - if (prefixOnly) { - regexRawTrigger = `^${regexRawTrigger}$`; - } else { - regexRawTrigger = `${regexRawTrigger}$`; - } + regexRawTrigger = `^${regexRawTrigger}$`; const regexTrigger = new RegExp(regexRawTrigger); hasTrigger = regexTrigger.test(body); } - if ((prefixOnly && !hasTrigger) || !hasTrigger) { + if (!hasTrigger) { core.setOutput("triggered", "false"); return; } diff --git a/index.js b/index.js index 11616d2..18db723 100755 --- a/index.js +++ b/index.js @@ -33,7 +33,6 @@ async function run() { const { owner, repo } = context.repo; - const prefixOnly = core.getInput("prefix_only") === 'true'; const allowArguments = core.getInput("allow_arguments") === 'true'; let hasTrigger = body.startsWith(trigger); @@ -41,18 +40,14 @@ async function run() { if (allowArguments) { let regexRawTrigger = trigger.replace(/\s\*{2}/g, ' [^\\s]+'); - if (prefixOnly) { - regexRawTrigger = `^${regexRawTrigger}$`; - } else { - regexRawTrigger = `${regexRawTrigger}$`; - } + regexRawTrigger = `^${regexRawTrigger}$`; const regexTrigger = new RegExp(regexRawTrigger); hasTrigger = regexTrigger.test(body); } - if ((prefixOnly && !hasTrigger) || !hasTrigger) { + if (!hasTrigger) { core.setOutput("triggered", "false"); return; } diff --git a/package-lock.json b/package-lock.json index 1b9833c..e6696f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pull-request-comment-trigger", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pull-request-comment-trigger", - "version": "2.1.0", + "version": "2.2.0", "license": "ISC", "dependencies": { "@actions/core": "^1.10.0", diff --git a/package.json b/package.json index 39d8f92..90b10df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pull-request-comment-trigger", - "version": "2.1.0", + "version": "2.2.0", "description": "", "main": "dist/index.js", "scripts": {