Skip to content

Commit

Permalink
Merge branch 'v2' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Aug 20, 2022
2 parents f7faa8f + e3e1191 commit ab9a08c
Show file tree
Hide file tree
Showing 11 changed files with 6,094 additions and 4,153 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '18'

- name: Install dependencies
run: npm ci
Expand All @@ -24,4 +24,4 @@ jobs:
run: npm test

- name: Check build artefact has been checked in
run: npm run build && git diff --quiet
run: npm run build && git diff
5 changes: 5 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,5 @@
{
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
30 changes: 24 additions & 6 deletions README.md
Expand Up @@ -20,26 +20,24 @@ jobs:
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v2
- uses: hmarr/auto-approve-action@v2
```


Combine with an `if` clause to only auto-approve certain users. For example, to auto-approve [Dependabot][dependabot] pull requests, use:

```yaml
name: Auto approve

on:
pull_request
on: pull_request

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v2
if: github.actor == 'dependabot[bot]'
- uses: hmarr/auto-approve-action@v2
if: github.actor == 'dependabot[bot]'
```

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 @@ -64,6 +62,26 @@ jobs:
pull-request-number: ${{ github.event.inputs.pullRequestNumber }}
```

Optionally, you can provide a message for the review:

```yaml
name: Auto approve

on: pull_request

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v2
if: github.actor == 'dependabot[bot]'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
review-message: "Auto approved automated PR"
```

## Why?

GitHub lets you prevent merges of unapproved pull requests. However, it's occasionally useful to selectively circumvent this restriction - for instance, some people want Dependabot's automated pull requests to not require approval.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Expand Up @@ -11,6 +11,9 @@ inputs:
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
review-message:
description: '(optional) The message of the pull request review.'
required: false
runs:
using: 'node12'
main: 'dist/index.js'

0 comments on commit ab9a08c

Please sign in to comment.