A GitHub App built with Probot that performs two functions:
- When a repository is created, it adds a (configurable) team to the repository with a given role (built in or custom)
- When a user or team is added to a repository (or role is changed) to a certain role it automatically changes it to another (effectively upgrading or downgrading a role).
Warning This is just a sample and it's not production ready code. For simplicity it doesn't has error handle and doesn't handle rate limits.
Note This is the worst named application in the world.
The app is configured with the following environment variables:
ROLE_TO_SWITCH
- The role to switch (e.g.maintainer
). Default value ismantain
.ROLE_TO_SWITCH_TO
- The role to switch to (e.g.admin
). Default value ismantain-plus
.ADD_TEAM_SLUG
- The team to add to the newly created repository (e.g.my-team
). Default value issecurity-alerts-team
.
# Install dependencies
npm install
# Run the bot
npm run build
npm start
# 1. Build container
npm run build
docker build -t repo-role-switcher .
# 2. Start container
docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> repo-role-switcher
ISC © 2023 Tiago Pascoal