Coder Social home page Coder Social logo

assign-reviewer-by-label's Introduction

Assign Reviewer by Labels

This action assigns reviewers when the specified labels applied to pull request.
Also, review request is cancelled when the specified labels are not applied. (option)

Inputs

token (required)

Usually set ${{ secret.GITHUB_TOKEN }}.
Or set your personal access token.

labels (required)

Labels as trigger when you want to assign reviewers.
If multiple settings, triggers when all labels applied.
When these labels removed, review request is cancelled.
You should set JSON array string.
ex) '[ "WFR", "ASAP" ]'

reviewers (required)

Reviewers you want to assign.
If multiple settings, everyone is assigned.
You should set JSON array string.
ex) '[ "cat", "neko", "nyan" ]'

remove-when-no-label (optional)

Remove reviewers if specified labels are not applied.
Useful for absolutely sync reviewer and labels.
Note: Manually assigning reviewers and not apply specifiled label, reviewer will be removed.
default: 'false'

Outputs

type

When reviewers are assgined, this value set assign.
When review request is cancelled, this value set remove.

skipped

If action was triggered but the reviewers did not change, this value set true.
Otherwise, this value set false.

url

HTML url for pull request.

Example usage

name: assign reviewer by labels
on:
  pull_request:
    types:
      - unlabeled
      - labeled

jobs:
  assign_and_remove_job:
    runs-on: ubuntu-latest
    name: assign and remove
    steps:
      - name: main
        id: reviewer
        uses: buildsville/assign-reviewer-by-label@v1
        with:
          token: "${{secrets.GITHUB_TOKEN}}"
          labels: '[ "WFR", "ASAP" ]'
          reviewers: '[ "cat", "neko", "nyan" ]'
          remove-when-no-label: 'true'
      - name: output done
        if: steps.reviewer.outputs.skipped == 'false'
        run: |
          echo "process done"
          echo "type: ${{ steps.reviewer.outputs.type }}"
          echo "url: ${{ steps.reviewer.outputs.url }}"
      - name: output skipped
        if: steps.reviewer.outputs.skipped == 'true'
        run: |
          echo "process skipped"
          echo "type: ${{ steps.reviewer.outputs.type }}"
          echo "url: ${{ steps.reviewer.outputs.url }}"

assign-reviewer-by-label's People

Contributors

buildsville avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

assign-reviewer-by-label's Issues

Approving the PR doesn't always reflect the approval in the "Reviewers" area

We're using this GitHub Action to assign reviewers to PRs based on the teams they're in. We've got labels for:

  • Frontend
  • Backend
  • DevOps

Several of the team members are in multiple teams, and the person raising the PR will almost always be part of the team(s) they are labelling the PR for.

Our YAML file looks like this:

name: Assign Reviewers by Label
on:
  pull_request:
    types:
      - opened
      - unlabeled
      - labeled

jobs:
  assign_frontend:
    runs-on: ubuntu-latest
    name: Assign Frontend Team
    steps:
      - name: Assign Frontend Team
        id: reviewer
        uses: buildsville/assign-reviewer-by-label@v1
        with:
          token: "${{secrets.GITHUB_TOKEN}}"
          labels: '[ "Frontend" ]'
          reviewers: '[ "person1", "person2", "person3"  ]'
  
  assign_backend:
    runs-on: ubuntu-latest
    name: Assign Backend Team
    steps:
      - name: Assign Backend Team
        id: reviewer
        uses: buildsville/assign-reviewer-by-label@v1
        with:
          token: "${{secrets.GITHUB_TOKEN}}"
          labels: '[ "Backend" ]'
          reviewers: '[ "person2", "person4", "person5" ]'
  
  assign_devops:
    runs-on: ubuntu-latest
    name: Assign DevOps Team
    steps:
      - name: Assign DevOps Team
        id: reviewer
        uses: buildsville/assign-reviewer-by-label@v1
        with:
          token: "${{secrets.GITHUB_TOKEN}}"
          labels: '[ "DevOps" ]'
          reviewers: '[ "person1", "person6" ]'

The reviewers are added to the PR as expected. However, we've noticed that occasionally, a review has to approve the PR multiple times before the reviewer is shown to have approved the PR in the reviewers' area of the sidebar. GitHub will show in the timeline that the user did approve the PR.

This only started happening after we started to use this GitHub Action. It may well be a GitHub bug, rather than an issue with the action itself, but I was wondering if you'd be able to advise. Thank you.

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.