Skip to content

Commit

Permalink
Added GitHub action to auto-merge (#55)
Browse files Browse the repository at this point in the history
* added github action to enable auto-merge in PRs

Added two GitHub actions to enable auto-merge in the repository.

This resolves #41

## [Auto-Merge-Bot](https://github.com/paritytech/auto-merge-bot)

This bot allows _public_ members of the organization and the author of the PR to enable/disable auto-merge in a PR. It also has a field for a list of users who are also allowed to trigger the bot. For that we have the second action.

* added step to allow fellows to trigger the bot

## [Get Fellows Action](https://github.com/paritytech/get-fellows-action)

This action gets the fellows from the chain data and it extracts their GitHub handles. This handles are then input into the `auto-merge-bot` action as a list of users who are allowed to trigger the bot.

* added a pull request template

I have also updated the Pull Request template to mention the existence of this bot to new contributors.

* added mention of the bot in the readme

Updated the readme to contain information about the bot, how to use it, and a link to its documentation
  • Loading branch information
Bullrich authored Oct 11, 2023
1 parent c86afcc commit ee6196c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Remember that you can run `/merge` to enable auto-merge in the PR -->
22 changes: 22 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Auto Merge Bot

on:
# GitHub considers PRs as issues
issue_comment:
types: [created]

jobs:
set-auto-merge:
runs-on: ubuntu-latest
# Important! This forces the job to run only on comments on Pull Requests that starts with '/merge'
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/merge') }}
steps:
- name: Get the GitHub handle of the fellows
uses: paritytech/[email protected]
id: fellows
- name: Set auto merge
uses: paritytech/[email protected]
with:
GITHUB_TOKEN: '${{ github.token }}'
MERGE_METHOD: "SQUASH"
ALLOWLIST: ${{ steps.fellows.outputs.github-handles }}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ Each leaf folder contains one runtime crate:
└── gluttons
└── glutton-kusama
```

# Working on Pull Requests

To merge a pull request, we use [Auto Merge Bot](https://github.com/paritytech/auto-merge-bot).

To use it, write a comment in a PR that says:

> `/merge`
This will enable [`auto-merge`](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) in the Pull Request (or merge it if it is ready to merge).

The automation can be triggered by the author of the PR or any fellow whose GitHub handle is part of their identity.

0 comments on commit ee6196c

Please sign in to comment.