Skip to content

Commit 0cfdac0

Browse files
authored
feat: using gh app for merging (#15)
1 parent 83617fa commit 0cfdac0

File tree

377 files changed

+7331
-88627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+7331
-88627
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.eslintrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"node": true,
5+
"es6": true
6+
},
7+
"parserOptions": {
8+
"sourceType": "script",
9+
"ecmaVersion": 2020
10+
},
11+
"rules": {
12+
"strict": ["error", "global"]
13+
}
14+
}

.github/dependabot.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ updates:
44
directory: '/'
55
schedule:
66
interval: daily
7-
- package-ecosystem: "github-actions"
8-
directory: "/"
7+
ignore:
8+
- dependency-name: 'husky'
9+
versions: ['5.x']
10+
- package-ecosystem: 'github-actions'
11+
directory: '/'
912
schedule:
10-
interval: "daily"
13+
interval: 'daily'

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
approve:
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: fastify/github-action-merge-dependabot@v1.2.1
7+
- uses: fastify/github-action-merge-dependabot@main
88
with:
99
github-token: ${{secrets.GITHUB_TOKEN}}
1010
approve-only: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vscode
2+
node_modules/

README.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ _Optional_ The merge method you would like to use (squash, merge, rebase). Defau
2424

2525
_Optional_ An arbitrary message that you'd like to comment on the PR after it gets auto-merged. This is only useful when you're recieving too much of noise in email and would like to filter mails for PRs that got automatically merged.
2626

27+
### `api-url`
28+
29+
_Optional_ A custom url where the external API which is delegated the task of approving and merging responds.
30+
2731
## Example usage
2832

2933
### Basic example
@@ -35,46 +39,41 @@ on: [push, pull_request]
3539
jobs:
3640
build:
3741
runs-on: ubuntu-latest
38-
steps: # ...
42+
steps:
43+
# ...
3944

4045
automerge:
4146
needs: build
4247
runs-on: ubuntu-latest
4348
steps:
44-
- uses: fastify/github-action-merge-dependabot@v1
45-
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
49+
- uses: fastify/github-action-merge-dependabot@v2
4650
with:
4751
github-token: ${{secrets.GITHUB_TOKEN}}
4852
```
4953
50-
### With `exclude`
54+
### Excluding packages
5155
5256
```yml
5357
steps:
54-
- uses: fastify/github-action-merge-dependabot@v1
55-
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
58+
- uses: fastify/github-action-merge-dependabot@v2
5659
with:
57-
github-token: ${{secrets.github_token}}
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
5861
exclude: ['react']
5962
```
6063
64+
### Approving without merging
65+
66+
```yml
67+
steps:
68+
- uses: fastify/github-action-merge-dependabot@v2
69+
with:
70+
github-token: ${{ secrets.GITHUB_TOKEN }}
71+
approve-only: true
72+
```
73+
6174
## Notes
6275
6376
- A GitHub token is automatically provided by Github Actions, which can be accessed using `secrets.GITHUB_TOKEN` and supplied to the action as an input `github-token`.
6477
- Only the [GitHub native Dependabot integration](https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically) is supported, the old [Dependabot Preview app](https://github.com/marketplace/dependabot-preview) isn't.
65-
- This action must be used in the context of a Pull Request. If the workflow can be triggered by other events (e.g. push), make sure to include `github.event_name == 'pull_request'` in the action conditions, as shown in the example.
6678
- Make sure to use `needs: <jobs>` to delay the auto-merging until CI checks (test/build) are passed.
6779
- If you want to use GitHub's [auto-merge](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/automatically-merging-a-pull-request) feature but still use this action to approve Pull Requests without merging, use `approve-only: true`.
68-
69-
## Limitations
70-
71-
One known limitation of using a GitHub action with the built-in GitHub Token to automatically merge Pull Requests is that the result of the merge will not trigger a workflow run.
72-
73-
What this means in practice is that after this action merges a Pull Request, no workflows are run on the commit made to the target branch.
74-
75-
This is a known behavior described in the [documentation](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token) which prevents triggering of recursive workflow runs.
76-
77-
Alternative options are:
78-
79-
- use a personal access token, as described in the documentation
80-
- use this action only for approving and using GitHub's auto-merge to merge Pull Requests

action.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
name: "Github Action Merge Dependabot"
2-
description: "Automatically approve and merge dependabot PRs"
1+
name: 'Github Action Merge Dependabot'
2+
description: 'Automatically approve and merge dependabot PRs'
33
inputs:
44
github-token:
5-
description: "A GitHub token"
5+
description: 'A GitHub token'
66
required: true
77
exclude:
8-
description: "Packages that you want to manually review before upgrading"
8+
description: 'Packages that you want to manually review before upgrading'
99
required: false
1010
approve-only:
11-
description: "If true, the PR is only approved but not merged"
11+
description: 'If true, the PR is only approved but not merged'
1212
required: false
1313
default: false
1414
merge-method:
15-
description: "The merge method you would like to use (squash, merge, rebase)"
15+
description: 'The merge method you would like to use (squash, merge, rebase)'
1616
required: false
17-
default: "squash"
17+
default: 'squash'
1818
merge-comment:
1919
description: "An arbitrary message that you'd like to comment on the PR after it gets auto-merged"
2020
required: false
21-
default: ""
21+
default: ''
22+
api-url:
23+
description: 'Url of the API where the application is running'
24+
required: false
25+
default: 'https://dependabot-merge-action-app.herokuapp.com/'
2226
runs:
23-
using: "node12"
24-
main: "src/index.js"
27+
using: 'node12'
28+
main: 'dist/index.js'

0 commit comments

Comments
 (0)