From 319def4371ee1ec78d5692ccc92f4f700bf475f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 19 Aug 2022 02:21:44 +0200 Subject: [PATCH 1/4] feat: default `github-token` to `github.token` --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c3d48f3..af823c1 100644 --- a/action.yml +++ b/action.yml @@ -5,8 +5,9 @@ branding: color: 'green' inputs: github-token: + default: ${{ github.token }} description: 'The GITHUB_TOKEN secret' - required: true + required: false pull-request-number: description: '(optional) The ID of a pull request to auto-approve. By default, this action tries to use the pull_request event payload.' required: false From f57f56082b9945e605ab0041f64371bc527f410f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 19 Aug 2022 02:22:33 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 92a513a..c07fd49 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Name:** `hmarr/auto-approve-action` -Automatically approve GitHub pull requests. The `GITHUB_TOKEN` secret must be provided as the `github-token` input for the action to work. +Automatically approve GitHub pull requests. **Important:** use v2.0.0 or later, as v1 was designed for the initial GitHub Actions beta, and no longer works. @@ -21,8 +21,6 @@ jobs: pull-requests: write steps: - uses: hmarr/auto-approve-action@v2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} ``` Combine with an `if` clause to only auto-approve certain users. For example, to auto-approve [Dependabot][dependabot] pull requests, use: @@ -40,8 +38,6 @@ jobs: steps: - uses: hmarr/auto-approve-action@v2 if: github.actor == 'dependabot[bot]' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} ``` If you want to use this action from a workflow file that doesn't run on the `pull_request` or `pull_request_target` events, use the `pull-request-number` input: @@ -63,7 +59,6 @@ jobs: steps: - uses: hmarr/auto-approve-action@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} pull-request-number: ${{ github.event.inputs.pullRequestNumber }} ``` @@ -83,7 +78,6 @@ jobs: - uses: hmarr/auto-approve-action@v2 if: github.actor == 'dependabot[bot]' with: - github-token: ${{ secrets.GITHUB_TOKEN }} review-message: "Auto approved automated PR" ``` From 2dfae02d1bd8ece82422c486770e6cedb981c361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 19 Aug 2022 02:23:02 +0200 Subject: [PATCH 3/4] Update main.ts --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 297ed66..42cee34 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,7 @@ import { approve } from "./approve"; export async function run() { try { - const token = core.getInput("github-token", { required: true }); + const token = core.getInput("github-token"); const reviewMessage = core.getInput("review-message"); await approve( token, From e3d47a328b28395f3a914d7c80ea3399560c15f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 19 Aug 2022 02:25:02 +0200 Subject: [PATCH 4/4] Update index.js --- dist/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8235393..192a953 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1806,7 +1806,6 @@ class Context { exports.Context = Context; //# sourceMappingURL=context.js.map - /***/ }), /***/ 5438: @@ -10224,7 +10223,7 @@ const approve_1 = __nccwpck_require__(6609); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const token = core.getInput("github-token", { required: true }); + const token = core.getInput("github-token"); const reviewMessage = core.getInput("review-message"); yield (0, approve_1.approve)(token, github.context, prNumber(), reviewMessage || undefined); }