Giter Site home page Giter Site logo

autolabeler-codeowners's Introduction

https://github.com/pratikmallya/autolabeler-codeowners/workflows/build-test/badge.svg?branch=master

autolabeler-codeowners

Adds labels to PR's based on CODEOWNERS. Useful in monorepos where there can be a ton of concurrent users and it might get hard to find the relevant PR for a particular team.

Example usage

The following is a fully functional Github Workflow. Note that a Github Oauth token needs to be added to the Github repo as a Github secret with the name githubToken.

on: [pull_request]
jobs:
  autolabeler-codeowners:
    runs-on: ubuntu-latest
    name: PR + CODEOWNERS Workflows
    steps:
    - uses: actions/checkout@v1
    - name: Add CODEOWNER Label To PR
      uses: pratikmallya/autolabeler-codeowners@releases/v1
      with:
        githubToken: ${{ secrets.githubToken }}

Deployment

The nodejs modules (in ./node_modules) and compiled JS (in ./lib) must be committed to the release branches but NOT to master (to keep master branch clean)

Testing

  • install dev deps using npm install --save-dev
  • run npm run test

Known Limitations

  • no retry logic: In practice not a huge deal as most PR's have multiple pushes and thus the workflow is triggered several times for the same PR.
  • only detects the first 100 files in a PR: This has not been a problem in practice since most PR's only make large changes within code-owned teams. Cross-codeowned, large changes have been rare. If this is a problem, feel free to open a PR/Issue with details!
  • does not work for PR's from forked repos for private repos: this is simply because the action is not triggered by Github so there is realistically no way to fix it. Github promises to fix this by GA

Release Process

(TODO: automate)

  • checkout to the release branch e.g. git checkout -b releases/v1
    1. If release branch already exists, git checkout releases/v1 and then pull in any new changes you need e.g. git merge master
  • uncomment ./node_modules and ./lib from .gitignore, this allows us to commit them
  • run npm prune --production to prune the modules
  • compile JS with npm run build
  • git add lib/ to add any newly generated JS files
  • commit to branch git commit -am "ADD: readying for release"
  • push branch
  • update Github Marketplace

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.