talebbits / monorepo-pr-labeler-action

🚊 A GitHub Action that labels PRs with the repo(s) impacted in a monorepo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🚊 Monorepo PR Repo Labeler - GitHub Action

A GitHub Action that labels pull requests with the modules(s) that are impacted in a monorepo.

How It Works

This GitHub Action runs when an pull_request event webhook is fired in your GitHub repo. The action checks if any of the files in the pull request are in a module (ex. /directory1/... from the root of the monorepo). If one or more modules are found, the pull request is labeled with a label for each module repo. Directories that beging with a dot (ex. /.directory/) are ignored.

Examples

Example of PR that has changes in two modules: GitHub Logo

Example of monorepo module structure: GitHub Logo

Installation

To use this GitHub Action, you must have access to GitHub Actions. GitHub Actions are currently only available in private beta (you must apply for access) and only work in private repos.

To setup this action:

  1. Create a .github/main.workflow in your GitHub repo.
  2. Add the following code to the main.workflow file and commit it to the repo's master branch.
workflow "Monorepo PR Repo Labeler" {
  resolves = ["Label PR Monorepos"]
  on = "pull_request"
}

action "Label PR Monorepos" {
  uses = "adamzolyak/monorepo-pr-labeler-action@master"
  secrets = ["GITHUB_TOKEN"]
}

Optionally add a BASE_DIRS config under env if modules are located within a directory. You can add one (ex. directory1) or more directories (ex. directory1|directory2|...) in the config.

workflow "Monorepo PR Repo Labeler" {
  resolves = ["Label PR Monorepos"]
  on = "pull_request"
}

action "Label PR Monorepos" {
  uses = "adamzolyak/monorepo-pr-labeler-action@master"
  secrets = ["GITHUB_TOKEN"]
  env = {
    BASE_DIRS = "directory1|directory2"
  }
}
  1. Whenever you open, edit, close, etc a pull request, the action will run!

Contributing

If you have suggestions for how this GitHub Action could be improved, or want to report a bug, open an issue! Or pull request! We'd love all and any contributions. For more, check out the Contributing Guide.

License

ISC Β© 2018 Adam Zolyak adam@tinkurlab.com (www.tinkurlab.com)

About

🚊 A GitHub Action that labels PRs with the repo(s) impacted in a monorepo.

License:ISC License


Languages

Language:JavaScript 91.5%Language:Dockerfile 6.7%Language:Shell 1.8%