Skip to content

greggigon/brunchyyy

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Brunchyyy - a friendly Neighbourhood Branch Naming Police Robot

Build status ISC License

A GitHub App (Robot) built with Probot. Robot monitors repositories for branch names and ensures those names are valid. Brunchyyy validates branch names against standard set of branches in GitFlow 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).

  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:

  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:

  deleteBranch: true

Technicalities

Brunchyyy Bot is build with Probot and Designed to run on AWS Lambda service. 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.

Once you clone this repository, simply run:

# Install dependencies
npm install

# Run the bot
npm start

# Run tests
npm run test

To build Webpack compressed Lambda function run:

  npm run dist

Resulting zip file is ready to be uploaded to AWS Lambda function with the following example command:

 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 © 2019 Greg Gigon greg.gigon@gmail.com (https://greggigon.com/brunchyyy)

About

Brunchyyy - a friendly Neighbourhood Branch Naming Police Robot (built with Probot)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published