๐ Github action to automate pull requests
This action allows you to use any of the pull_request
webhook event to automate pull request reviews. For example when a pull request
is opened
by dependabot
, automatically approve it.
- Create a new workflow by adding
.github/workflows/pull-request-automation.yml
to your project. - In the
pull-request-automation.yml
you have to decide which events you'll act on and the actors pull requests to automate.
For example:
To approve all pull requests pull requests from dependabot
, you would add the following to the yml
file:
name: Automatic pull request review
on: [pull_request]
jobs:
automate-pullrequest-review:
runs-on: ubuntu-latest
steps:
- name: Approve pull request
if: github.actor == 'dependabot[bot]'
uses: andrewmusgrave/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
event: APPROVE
body: 'Thank you dependabot ๐'
These are the options recommended to be changed. For more detailed explanation of the workflow file, check out the GitHub documentation.
Setting | Description | Values |
---|---|---|
event |
The event to perform on the pull request review. | APPROVE | COMMENT | DISMISS | REQUEST_CHANGES |
body |
The contents of the review body comment. Required when event is COMMENT or REQUEST_CHANGES | String |
repo-token |
The personal access token | ${{ secrets.GITHUB_TOKEN }} |