Skip to content

Commit

Permalink
feat: default github-token to github.token (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored Aug 20, 2022
1 parent e3e1191 commit 61ba000
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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 }}
```

Expand All @@ -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"
```

Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 61ba000

Please sign in to comment.