Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 26, 2021 01:56 pm GMT

Bulk merge & Approve Github Pull Requests with the Gomerge github action!

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.

Gomerge Maschot Cover

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.

Gomerge Action in Action

Submission Category:

Maintainer Must-Haves

Yaml File or Link to Code

GitHub logo 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!


Original Link: https://dev.to/cian911/bulk-merge-approve-github-pull-requests-with-the-gomerge-github-action-1omh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To