Assemble multiple CODEOWNERS file into one

Codeowners

Tool to generate a GitHub CODEOWNERS file from multiple CODEOWNERS files throughout the repo. This makes it easier to manage code ownership in large repos and thereby reduces the number of irrelevant review requests and blocked PRs.

Example

By default, GitHub expects one CODEOWNERS file in the repos .github dir like this:

# File: .github/CODEOWNERS

* @org/admin-user
src/go @org/go-developer
src/go/lib.go @org/lib-specialist

This file tends to get messy and outdated in large repos with many contributors, leading to lots of unnecessary approval requests in pull requests.

With this tool these files can instead be placed into the directories to which they refer:

# File: CODEOWNERS
# Root CODEOWNERS file that sets the default owner of everything in this repo

@org/admin-user  # No glob required here, target is taken from the location of this CODEOWNERS file
# File: src/go/CODEOWNERS
# Tiny nested file that sets the owner of everything under src/go

@org/go-developer
lib.go @org/lib-specialist

Note that in the second file, ownership for an individual file can still be assigned as expected. Patterns like *.go can be used as well, though they should only refer to the subdirectory they are located in.

codeowners has to be invoked with the path to the repo, i.e. codeowners path/to/repo. It will traverse all CODEOWNERS files within it (but respecting .gitignore files) and print the correct root CODEOWNERS file for GitHub to stdout. The .github/CODEOWNERS file itself is not modified, to overwrite it use codeowners path/to/repo > path/to/repo/.github/CODEOWNERS.

Installation

Install as a Go tool via go get github.com/gmolau/codeowners.

Use as GitHub Action

For maximum convenience it is recommended to run this tool automatically in a GitHub Action like this:

# File: .github/workflows/codeowners.yaml

name: Update CODEOWNERS
on:
  pull_request:
    paths:
      - "**/CODEOWNERS"        # Trigger for every CODEOWNERS file in the repo
      - "!.github/CODEOWNERS"  # except for the generated file itself
jobs:
  update-codeowners:
    runs-on: ubuntu-20.04
    name: Update CODEOWNERS
    steps:
      - name: Checkout repo
        uses: actions/[email protected]
      - name: Update CODEOWNERS file
        uses: gmolau/[email protected]
    - name: Commit CODEOWNERS file
        uses: EndBug/[email protected]
        with:
          message: Update CODEOWNERS file (CODEOWNERS Bot)

This workflow runs on every change to a CODEOWNERS file and regenerates and commits the root CODEOWNERS file.

Similar Resources

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

In one particular project, i had to import some key/value data to Prometheus. So i have decided to create my custom-built Node Exporter in Golang.

May 19, 2022

A reimplementation of the TinyGo drivers package for communicating with multiples of the same (supported) devices on one individual I2C bus.

tinygo-multi-i2c A reimplementation of the TinyGo drivers package for communicating with multiples of the same (supported) devices on one individual I

Mar 10, 2022

Terraform Provider for cascading runs across multiple workspaces.

Terraform Multispace Provider The multispace Terraform provider implements resources to help work with multi-workspace workflows in Terraform Cloud (o

Jul 6, 2022

Help to release a project which especially has multiple git repositories

This project aims to help to release a project which especially has multiple git repositories. Installation Install it to a Kubernetes cluster. You ca

Jul 7, 2022

detects conflicting requirements between multiple go.mod files

gomodconflict Prints out conflicting version requirements between multiple go.mod files. Building First download earthly. Then run: earthly +all buil

Nov 3, 2021

An easy-to-use Map Reduce Go parallel-computing framework inspired by 2021 6.824 lab1. It supports multiple workers on a single machine right now.

MapReduce This is an easy-to-use Map Reduce Go framework inspired by 2021 6.824 lab1. Feature Multiple workers on single machine right now. Easy to pa

Sep 13, 2022

Filter out multiple strings from stdin.

minus The minus tool accepts data from stdin and filters out any arguments passed. It simplifies something like this: some_command | grep -vF thing1 |

Dec 20, 2021

An easy way to add useful startup banners into your Go applications

An easy way to add useful startup banners into your Go applications

Try browsing the code on Sourcegraph! Banner Add beautiful banners into your Go applications Table of Contents Motivation Usage API Command line flags

Sep 16, 2022

Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubico Yubikey into your existing Go-based user authentication infrastructure.

yubigo Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubikey into any Go application. Installation Installation is

Aug 5, 2022
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more
Quickly clone an entire org/users repositories into one directory - Supports GitHub, GitLab, Bitbucket, and more

ghorg ghorg allows you to quickly clone all of an orgs, or users repos into a single directory. This can be useful in many situations including Search

Sep 27, 2022
Simple Golang API to demonstrate file upload to fireabase storage and retrieving url of uploaded file.

go-firebase-storage -Work in progress ??️ Simple Golang API that uses Firebase as its backend to demonstrate various firebase services using Go such a

Oct 4, 2021
Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file

About hclmergetool Works with HashiCorp HCL. Allows to append the input file with blocks and attributes from the template file Installation Binary Rel

Feb 6, 2022
safe and easy casting from one type to another in Go

cast Easy and safe casting from one type to another in Go Don’t Panic! ... Cast What is Cast? Cast is a library to convert between different go types

Sep 26, 2022
Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.
Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for. Screenshots First, input PIN Then enjoy! Hoste

Mar 11, 2022
Go implementation Welford’s method for one-pass variance computation

Variance and standard deviation caluculation using variance's algorithm Table of Contents Introduction Installation Usage Contributing License Introdu

Jun 5, 2022
Run The World. Command aggregator output. Define many services watch them in one place.

Run The World. Command aggregator output. Define many services watch them in one place.

Feb 2, 2022
K3ai Executor is the runner pod to execute the "one-click" pipelines
K3ai Executor is the runner pod to execute the

Welcome to K3ai Project K3ai is a lightweight tool to get an AI Infrastructure Stack up in minutes not days. NOTE on the K3ai origins Original K3ai Pr

Nov 11, 2021
Create one endpoint with add user functionality

hubuc-task Create one endpoint with add user functionality

Nov 13, 2021
gonewire: one wire library that uses the w1 kernel module

gonewire one wire library that uses the w1 kernel module. current support: DS18(S)20

Jan 25, 2022