Skip to content

Commit

Permalink
feat: add option to customise bot name (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
moroine authored Oct 22, 2021
1 parent 0bd8bdd commit 89c31b6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ steps:
| `config` | ✔ | `.github/auto-merge.yml` | Path to configuration file *(relative to root)* |
| `target` | ❌ | `patch` | The version comparison target (major, minor, patch) |
| `command` | ❌ | `merge` | The command to pass to Dependabot |
| `botName` | ❌ | `dependabot` | The bot to tag in approve/comment message. |
| `approve` | ❌ | `true` | Auto-approve pull-requests |

### Token Scope
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ inputs:
default: merge
required: false

botName:
description: The bot to tag in approve/comment message. You can use this to create your own merge bot.
default: dependabot
required: false

approve:
description: Auto-approve pull-requests
default: 'true'
Expand Down
1 change: 1 addition & 0 deletions action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const inputs = {
config: core.getInput('config', { required: false }),
target: core.getInput('target', { required: false }),
command: core.getInput('command', { required: false }),
botName: core.getInput('botName', { required: false }),
approve: core.getInput('approve', { required: false })
}

Expand Down
3 changes: 2 additions & 1 deletion action/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default async function (inputs) {

if (proceed) {
const command = inputs.approve === 'true' ? approve : comment
const botName = inputs.botName || 'dependabot'

await command(octokit, repo, pull_request, `@dependabot ${inputs.command}`)
await command(octokit, repo, pull_request, `@${botName} ${inputs.command}`)
}
}
13 changes: 7 additions & 6 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ steps:

### Inputs

| input | required | default | description |
| -------------- | -------- | ------------------------- | -------------------------------------------------- |
| input | required | default | description |
|----------------|----------|--------------------------|-----------------------------------------------------|
| `github-token` | ✔ | `github.token` | The GitHub token used to merge the pull-request |
| `config` | ✔ | `.github/auto-merge.yml` | Path to configuration file _(relative to root)_ |
| `target` | ❌ | `patch` | The version comparison target (major, minor, patch) |
| `command` | ❌ | `merge` | The command to pass to Dependabot |
| `approve` | ❌ | `true` | Auto-approve pull-requests |
| `config` | ✔ | `.github/auto-merge.yml` | Path to configuration file *(relative to root)* |
| `target` | ❌ | `patch` | The version comparison target (major, minor, patch) |
| `command` | ❌ | `merge` | The command to pass to Dependabot |
| `botName` | ❌ | `dependabot` | The bot to tag in approve/comment message. |
| `approve` | ❌ | `true` | Auto-approve pull-requests |

### Token Scope

Expand Down

0 comments on commit 89c31b6

Please sign in to comment.