Skip to content

Commit 61ba000

Browse files
feat: default github-token to github.token (#202)
1 parent e3e1191 commit 61ba000

4 files changed

Lines changed: 5 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Name:** `hmarr/auto-approve-action`
44

5-
Automatically approve GitHub pull requests. The `GITHUB_TOKEN` secret must be provided as the `github-token` input for the action to work.
5+
Automatically approve GitHub pull requests.
66

77
**Important:** use v2.0.0 or later, as v1 was designed for the initial GitHub Actions beta, and no longer works.
88

@@ -21,8 +21,6 @@ jobs:
2121
pull-requests: write
2222
steps:
2323
- uses: hmarr/auto-approve-action@v2
24-
with:
25-
github-token: ${{ secrets.GITHUB_TOKEN }}
2624
```
2725
2826
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:
4038
steps:
4139
- uses: hmarr/auto-approve-action@v2
4240
if: github.actor == 'dependabot[bot]'
43-
with:
44-
github-token: ${{ secrets.GITHUB_TOKEN }}
4541
```
4642

4743
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:
6359
steps:
6460
- uses: hmarr/auto-approve-action@v2
6561
with:
66-
github-token: ${{ secrets.GITHUB_TOKEN }}
6762
pull-request-number: ${{ github.event.inputs.pullRequestNumber }}
6863
```
6964

@@ -83,7 +78,6 @@ jobs:
8378
- uses: hmarr/auto-approve-action@v2
8479
if: github.actor == 'dependabot[bot]'
8580
with:
86-
github-token: ${{ secrets.GITHUB_TOKEN }}
8781
review-message: "Auto approved automated PR"
8882
```
8983

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ branding:
55
color: 'green'
66
inputs:
77
github-token:
8+
default: ${{ github.token }}
89
description: 'The GITHUB_TOKEN secret'
9-
required: true
10+
required: false
1011
pull-request-number:
1112
description: '(optional) The ID of a pull request to auto-approve. By default, this action tries to use the pull_request event payload.'
1213
required: false

dist/index.js

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { approve } from "./approve";
44

55
export async function run() {
66
try {
7-
const token = core.getInput("github-token", { required: true });
7+
const token = core.getInput("github-token");
88
const reviewMessage = core.getInput("review-message");
99
await approve(
1010
token,

0 commit comments

Comments
 (0)