All Projects β†’ s4heid β†’ branch-switcher

s4heid / branch-switcher

Licence: Apache-2.0 license
a GitHub bot that switches the base branch of pull requests to the preferred branch

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to branch-switcher

scalafmt-probot
πŸ€–Github bot for checking code formatting with scalafmt
Stars: ✭ 15 (+0%)
Mutual labels:  probot, pull-requests, github-app, probot-app
Probot Gpg
A GitHub App that enforces GPG signatures on pull requests (no longer maintained)
Stars: ✭ 13 (-13.33%)
Mutual labels:  probot, pull-requests, github-app, probot-app
new-pr-welcome
Welcome users when they open their first PR in your repository
Stars: ✭ 20 (+33.33%)
Mutual labels:  probot, github-app, probot-app
linter-alex
πŸ“Sensitive, considerate writing before you merge your Pull Requests
Stars: ✭ 67 (+346.67%)
Mutual labels:  probot, github-app, probot-app
Weekly Digest
Weekly summary of activity on your GitHub repository πŸ“†
Stars: ✭ 199 (+1226.67%)
Mutual labels:  probot, github-app, probot-app
Stale
A GitHub App built with Probot that closes abandoned Issues and Pull Requests after a period of inactivity.
Stars: ✭ 1,070 (+7033.33%)
Mutual labels:  probot, github-app, probot-app
Todo
πŸ€–βœ… GitHub App that creates new issues from actionable comments in your code.
Stars: ✭ 685 (+4466.67%)
Mutual labels:  probot, github-app, probot-app
Mergeable
πŸ€– All the missing GitHub automation πŸ™‚ πŸ™Œ
Stars: ✭ 475 (+3066.67%)
Mutual labels:  probot, github-app, probot-app
issuelabeler
A GitHub bot to label issues automatically based on title and body against list of defined labels. System status (https://status.verticalaxisbd.com/)
Stars: ✭ 23 (+53.33%)
Mutual labels:  probot, github-app, probot-app
Request Info
Requests more info from PRs/Issues with either the default title or a blank body
Stars: ✭ 89 (+493.33%)
Mutual labels:  probot, github-app, probot-app
Auto Assign
πŸ€– A Probot app that adds reviewers to pull requests when pull requests are opened.
Stars: ✭ 140 (+833.33%)
Mutual labels:  probot, github-app, probot-app
Gh Polls Bot
Automatically create polls in GitHub issues.
Stars: ✭ 187 (+1146.67%)
Mutual labels:  probot, github-app, probot-app
react-preview
a GitHub App built with probot that generates preview links for react based projects.
Stars: ✭ 14 (-6.67%)
Mutual labels:  probot, github-app, probot-app
merge-me
A GitHub app that merges your pull requests once all required checks pass.
Stars: ✭ 19 (+26.67%)
Mutual labels:  probot, github-app, probot-app
boring-cyborg
πŸ€– A Github bot to automatically label PRs, issues and perform all the boring operations that you don't want to do.
Stars: ✭ 66 (+340%)
Mutual labels:  probot, github-app, probot-app
Commitlint Bot
[NOT MAINTAINED] use https://github.com/apps/semantic-pull-requests
Stars: ✭ 157 (+946.67%)
Mutual labels:  probot, github-app, probot-app
Probot Conventional Release
A GitHub App built with Probot that creates GitHub Release following Conventional Commits
Stars: ✭ 48 (+220%)
Mutual labels:  probot, probot-app
First Timers Bot
A friendly bot that helps onboarding new Open Source Contributors
Stars: ✭ 239 (+1493.33%)
Mutual labels:  probot, probot-app
Pull
πŸ€– Keep your forks up-to-date via automated PRs
Stars: ✭ 3,364 (+22326.67%)
Mutual labels:  probot, probot-app
probot-issue-duplicate-detection
A probot plugin for automatic issue duplicate detection
Stars: ✭ 31 (+106.67%)
Mutual labels:  probot, probot-app

branch-switcher

Build Status License JavaScript Style Guide

A GitHub App built with Probot that automatically updates the base ref of a pull request if it has been opened against a non-preferred branch.

How it works

In projects where the default branch is not master, pull requests are often opened against a wrong branch. Typically, maintainers of the project need to reach out to the authors and ask them to change the base branch as most bigger projects have automated tests configured against the default branch.

The intent of this GitHub app is to support maintainers by automatically changing the base branch of pull requests to the default branch if applicable. The app listens to a set of webhooks:

  • pull_request.opened,
  • pull_request.reopened,
  • pull_request.edited,
  • pull_request.labeled,
  • pull_request.unlabeled,

which triggers

  • a check whether the base branch of the pull request matches the preferred branch and changes it if applicable,
  • comments on the pull request and informs the author about the changes being made.

Installation

  1. Install the GitHub App for the intended repositories.
  2. Create a .github/branch-switcher.yml file in the root of the intended repositories where branch-switcher has been installed. This configuration file is optional and overrides any of the default settings.

Configuration

The following properties are currently supported:

  • preferredBranch (string) - name of the preferred branch against which the pull request should be opened. Default: develop.
  • switchComment (string) - content of the message indicating that the base has been updated to the preferred branch. {{author}} can be used as a placeholder which interpolates to the pull request author and {{preferredBranch}} analogously.
  • exclude (Array) - list of all branches and labels that should be ignored. By default, all branches are considered and no labels are excluded.
    • branch (string) - name of the branch that should be ignored.
    • label (string) - name of the label that should be ignored.

Example .github/branch-switcher.yml:

exclude:
- branch: do-nothing
- branch: dont-touch-*
- label: ignore-me
switchComment: >
  Hey @{{author}}, the base branch of your pull request has been changed
  to {{preferredBranch}}. Have a nice day! :wave:

Above config does not touch the base branch if there is a label ignore-me attached on the pull request and it also does not switch if the base branch is either called do-nothing or every branch matching the wildcard dont-touch-*.

Development

  1. Follow the docs for deployment and set the following Permissions & events for the GitHub App:
  • Pull requests - Read & Write
    • Check the box for Pull request review comment events
  • Repository metadata - Read-only
  • Single File - Read-only
    • Path: .github/branch-switcher.yml
  1. Clone the repo:
git clone [email protected]:s4heid/branch-switcher.git
  1. Copy .env.example to .env and set the right environment variables as described in the official probot docs
  2. Install app dependencies and run the app:
# Install dependencies
npm install

# Run typescript and run the bot
npm run build && npm start

Contributing

If you have suggestions for how branch-switcher could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

License

Apache 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].