Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: default github-token to github.token #202

Merged
merged 4 commits into from Aug 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions README.md
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
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
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