My Workflow
Are you an open source maintainer? Do you get dozens of contributions from your community every week? Are you someone who would like to automate everything?
Late last year, I created the Gomerge CLI tool. Gomerge is a tool which allows you to quickly bulk merge and approve several pull requests from your terminal.
With the github actions hackathon on the horizon, I thought I would take the opportunity and containerize Gomerge into it's own custom Github Action, with some new features to boot!
The gomerge github action is now available on the github marketplace. You can also view the action directly on the github repository.
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
Cian911 / gomerge-action
Github action utilising the Gomerge CLI tool to bulk merge and approve pull requests.
gomerge-action
Github action which utilizes the Gomerge CLI tool, also created by myself, to bulk merge and approve github pull requests.
Behind the scenes, Gomerge will determine the mergeability of a pull request by checking the following attributes:
- CI Status (success, pending, failure)
- Mergeable State (clean, blocked, dirty)
- Pull Request State (open, draft, closed)
If any of these metrics are not in a valid state, the pull request will not be approved/merged.
Usage & Examples
Below outlines a list of possible use cases if you wanted to automated your repositories approval/merge workflow.
You can also specify a list of labels in the following format label1,label2...
and pass that as option like so:
with:
labels: label1,label2
This will filter all Pull Requests that only have the associated labels.
Run action once a day at midnight to approve all valid Pull Requests.
on
schedule:
- cron:
…Github action which utilizes the Gomerge CLI tool, also created by myself, to bulk merge and approve github pull requests.
Behind the scenes, Gomerge will determine the mergeability of a pull request by checking the following attributes:
- CI Status (success, pending, failure)
- Mergeable State (clean, blocked, dirty)
- Pull Request State (open, draft, closed)
If any of these metrics are not in a valid state, the pull request will not be approved/merged.
Below I've outlined an example which will run the action at midnight every night and approve only valid pull requests.
on:
schedule:
- cron: '0 0 * * *'
jobs:
approve-prs:
runs-on: ubuntu-latest
name: Approve valid PRs
steps:
- name: Approve valid workflows
uses: Cian911/gomerge-action@master
with:
repository: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ""
approve: "true"
Additional Resources / Info
For more information and examples, please visit the gomerge-action github page for a full list. You can also visit my test repo, gomerge-test which contains a working example of the action.
Thank you for reading!
Top comments (2)
Wow this is very great! Using this in my workflow!
Thank you! Glad you like it!