Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greggigon/brunchyyy
Brunchyyy - a friendly Neighbourhood Branch Naming Police Robot (built with Probot)
https://github.com/greggigon/brunchyyy
github-app javascript probot probot-app
Last synced: 3 months ago
JSON representation
Brunchyyy - a friendly Neighbourhood Branch Naming Police Robot (built with Probot)
- Host: GitHub
- URL: https://github.com/greggigon/brunchyyy
- Owner: greggigon
- License: isc
- Created: 2019-11-05T15:27:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T13:03:04.000Z (almost 2 years ago)
- Last Synced: 2023-03-23T01:01:26.459Z (almost 2 years ago)
- Topics: github-app, javascript, probot, probot-app
- Language: JavaScript
- Size: 1.83 MB
- Stars: 3
- Watchers: 1
- Forks: 6
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Brunchyyy - a friendly Neighbourhood Branch Naming Police Robot
![Build status](https://github.com/greggigon/brunchyyy/workflows/Test%20and%20Lint/badge.svg) ![ISC License](https://img.shields.io/badge/license-ISC-green)
> A GitHub App (Robot) built with [Probot](https://github.com/probot/probot).
> Robot monitors repositories for branch names and ensures those names are valid.
> Brunchyyy validates branch names against standard set of branches in [GitFlow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) workflow model.## How Brunchyyy works
Brunchyyy is monitoring **PUSH** events in the GitHub. As soon as event is received, it will compare if the branch for the event (refs/heads/* element of event payload) has a name that complies with the following requirements:
* non-prefixed branches are only **master** or **develop**
* prefixed branches use one of the following prefixes: **feature/**, **bugfix/**, **hotfix/** and **release/**, lowercase only
* branch names schould contain alphanumeric characters, digits and following special characters `-`, `_`, `.` and `#`If the branch is named outside of the above rules, by default it will raise an issue against the repository and assign the user who pushed the branch to it.
If **Brunchyyy** users would like for the Robot to be a bit more firm, they can use **Brunchyyy** configuration file, to setup branch deletion option.
It will cause the offending branch to be **DELETED** instead of **issue raised** against the repository.## Configuring Brunchyyy
At this moment, there is only one configuration option for **Brunchyyy**, it tells the Robot if a branch with invalid name should be deleted, instead of having an issue raised against it.
Configuration is stored in the repository, in **.github** folder in **brunchyyy.yml** file (`.github/brunchyyy.yml`).
```bash
2019-11-08 14:49:07 ⌚ Mac in ~/projects/sample-brunchyyy-repository
± |master ✓| → ls .github/
brunchyyy.yml
```### Defining allowed branches names and prefixes
To explicitly set what non-prefixed branch names and which prefixies for branches are allowed, the following can be added to the configuration file:
```yaml
allowedBranchNaming:
allowedNames: ['master', 'develop']
allowedPrefixes: ['feature', 'fix']
```
The configution above will allow branches named `master` and `develop` only, plus any branch prefixed with `feature` or `fix`.### Deleting not allowed branches if found
The configuration parameter is called `deleteBranch` and is by default set to `false`.
To enable branch delation, add the following attibute to the configuration file:```yaml
deleteBranch: true
```## Technicalities
Brunchyyy Bot is build with Probot and Designed to run on AWS Lambda service. [app.yml](app.yml) file constains a list of Permissions required and Events the Bot listens to.
To build Brunchyyy and run it locally follow the guide for [Probot](https://probot.github.io/docs/development/).
Once you clone this repository, simply run:
```sh
# Install dependencies
npm install# Run the bot
npm start# Run tests
npm run test
```To build Webpack compressed Lambda function run:
```sh
npm run dist
```Resulting zip file is ready to be uploaded to AWS Lambda function with the following example command:
```sh
2019-11-08 15:44:45 ⌚ Mac in ~/projects/brunchy
± |master ✓| → aws lambda update-function-code --function-name Brunchyyy --zip-file fileb://brunchyyy.bundle.zip
```## Contributing
If you have suggestions for how Brunchyyy could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
Open issue with suggestion or a PR.
## License
[ISC](LICENSE) © 2019 Greg Gigon (https://greggigon.com/brunchyyy)