Coder Social home page Coder Social logo

trask / component-owners Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dyladan/component-owners

0.0 1.0 0.0 333 KB

Automatically add component owners as assignees and approvers to pull requests

License: Apache License 2.0

TypeScript 100.00%

component-owners's Introduction

component-owners

Automatically add component owners as assignees and approvers to pull requests.

This works very similarly to CODEOWNERS, however with CODEOWNERS all owners must have write access to the repository. Many open source projects wish to assign some level of ownership of individual components, but are hesitant to grant write access to those owners. This action only requires that component owners be collaborators on the repository or members of the organization, but does NOT require they have write access.

Getting Started

First, create a configuration file. By default, the action will look in .github/component_owners.yml.

# .github/component_owners.yml

# Each component identified by its path prefix has a list of owners
components:
  # Ownership applies recursively to any file in a directory
  src/:
    - owner1 # owner1 owns all files in src/

  # Ownership can be assigned as a string
  src/index.ts: owner2 owner3
  
  # or a list
  src/list-owners.ts:
    - owner3
    - owner4

  # Ownership can be assigned based on a file extension
  "*.md":
    - owner5

# Optionally ignore some PR authors to reduce spam for your component owners
ignored-authors:
  - dependabot
  - renovate-bot

Next, create your github action yml.

name: 'Component Owners'
on:
  # pull_request_target is suggested for projects where pull requests will be
  # made from forked repositories. If pull_request is used in these cases,
  # the github token will not have sufficient permission to update the PR.
  pull_request_target:

jobs:
  run_self:
    runs-on: ubuntu-latest
    name: Auto Assign Owners
    steps:
      - uses: dyladan/component-owners@main
        with:
          # default: .github/component_owners.yml
          config-file: .github/component_owners.yml
          # default: ${{ github.token }}
          repo-token: ${{ github.token }} 
          # default: true
          assign-owners: "true"
          # default: true
          request-owner-reviews: "true"

Configuration

config-file

default: .github/component_owners.yml

Path to configuration file.

repo-token

default: ${{ github.token }}

GitHub personal access token. Must have permission to read and write pull requests. The default github.token is typically sufficient.

assign-owners

default: true

Determines if the component owners should be added to the pull request as assignees.

request-owner-reviews

default: true

Determines pull request reviews should be requested from component owners.

Why not use CODEOWNERS?

Great question. If all of your contributors have write access to your repo, CODEOWNERS is a great solution. If, like many open source projects, you would like to assign some ownership of a single component of your repository, but you don't want to grant those component owners write access to the repo, this action can help.

component-owners's People

Contributors

dyladan avatar rauno56 avatar trask avatar

Watchers

 avatar

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.