Giter Site home page Giter Site logo

auto-assign-review-teams's Introduction

  • ๐Ÿ’ฌ Ask me about ...

    • Kotlin ๐Ÿฅณ, GitHub Actions ๐Ÿค–, Spring Boot ๐Ÿƒ, Cloud Native โ˜๏ธ
    • OpenAPI/Swagger, REST, GraphQL ๐Ÿ”Œ
    • Clean Code, Developer Experience / Best Practices
    • CI / CD & GitOps, ArgoCD
  • ๐Ÿ˜„ Attributes:

    • Early Adpoter ๐Ÿค“
    • (Somtimes) too Early Adpoter ๐Ÿ’ฃ
    • Motivated ๐Ÿ’ช๐Ÿป Status Quo ๐Ÿ’ค
  • Currently Learning ๐Ÿ‘จ๐Ÿปโ€๐Ÿซ

auto-assign-review-teams's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar harrygogonis avatar kremalicious avatar rowi1de avatar sinchang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

auto-assign-review-teams's Issues

Exlcuding draft PRs doesn't work

Using v1.0.0 of this action, the action runs on PRs which are created as Draft, and which have never been moved to the Open/ready-for-review state.

I have set include-draft: false in the config:

name: "Assign Reviewers"
on:  
  pull_request:
    types: [opened, ready_for_review]

jobs:
  assign-reviewers:
    runs-on: ubuntu-latest
    steps:
    - name: "Request review from Android team"
      uses: rowi1de/[email protected]
      with:
        repo-token: ${{ secrets.YBOT_ACCESS_TOKEN }}
        teams: "android"                # only works for GitHub Organisation/Teams
        persons: ""                     # add individual persons here 
        include-draft: false            # Draft PRs will be skipped (default: false)

Is there something else I need to do to exclude Draft PRs?

Ambiguity in the API definition (teams/persons)

The introduction of the VSCode GitHub Actions extension allows us to perform direct validation of workflows.

Utilizing this action with only persons as an input parameter will result in the YAML scheme validation error: Missing required input 'teams'.

Considering that the action returns a runtime error when neither teams nor persons is set (Please specify 'teams' and/or 'persons'), I suggest making both input parameters optional (required: false). I am more than happy to open a PR if this is an acceptable solution.

Getting "Validation Failed: "Could not resolve to a node with the global id of..." error

I've set up the following workflow:

name: "Assign Review Candidates"
on:
  pull_request:
    types: [labeled]

jobs:
  assign-reviewers:
    runs-on: ubuntu-latest
    steps:
      - name: "Assign NodeJS Review Candidate Team"
        if: github.event.label.name == 'nodejs-pr'
        uses: rowi1de/[email protected]
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          teams: "nodejs-reviewers-candidates"         # only works for GitHub Organisation/Teams
          include-draft: false            # Draft PRs will be skipped (default: false)
          skip-with-manual-reviewers: 10   # Skip this action, if the number of reviewers was already assigned (default: 0)
      - name: "Assign App Review Candidate Team"
        if: github.event.label.name == 'app-pr'
        uses: rowi1de/[email protected]
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          teams: "app-reviewers-candidates"         # only works for GitHub Organisation/Teams
          include-draft: false            # Draft PRs will be skipped (default: false)
          skip-with-manual-reviewers: 10   # Skip this action, if the number of reviewers was already assigned (default: 0)

and I've verified that the action is getting called. However, I'm getting the following error when it's run:

Run rowi1de/[email protected]
  with:
    repo-token: ***
    teams: nodejs-reviewers-candidates
    include-draft: false
    skip-with-manual-reviewers: 10
Adding teams: nodejs-reviewers-candidates, persons: 
##[error]Validation Failed: "Could not resolve to a node with the global id of 'MDQ6VGVhbTM3MDM1NzY='."
(node:2794) UnhandledPromiseRejectionWarning: HttpError: Validation Failed: "Could not resolve to a node with the global id of 'MDQ6VGVhbTM3MDM1NzY='."
    at /home/runner/work/_actions/rowi1de/auto-assign-review-teams/v1.0.0/lib/index.js:8052:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:2794) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2794) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

It appears that if I type a non existing team, I don't get any errors. But if I type the team that does exist (which has write access to my repo btw), I get this error. Not sure if this is a bug, or user error. Any pointers would be appreciated. Thanks!

Receiving 'Bad credentials' on organisation repository.

I'm receiving this error

(node:1494) UnhandledPromiseRejectionWarning: HttpError: Bad credentials
    at /home/runner/work/_actions/rowi1de/auto-assign-review-teams/v.1.0.1/lib/index.js:8062:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    (node:1494) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1494) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Bad credentials

When trying to run the action to automatically assign a team on each PR created.
Here's my team-assigner.yaml file

name: "Assign Reviewers"

on:
  pull_request:
    branches:
      - 'develop'
      - 'release/**'
     
jobs:
  assign-reviewers:
    runs-on: ubuntu-latest
    steps:
    - name: "Assign team review"
      uses: rowi1de/[email protected]
      with:
        repo-token: ${{ secrets.TEAM_ASSIGNER_TOKEN }}
        teams: "team_name"
        skip-with-manual-reviewers: 3

TEAM_ASSIGNER_TOKEN is listed in the Repository tokens in the repository settings tab.

Picking one from team should exit early if one from team already assigned to review

I believe there should be an early return if pick-one-from-persons-or-team and teams are both set and there is already a reviewer assigned from that team on the PR.

// Picking out 1 person from first team listed
console.log('Selecting from first team provided: ' + teams[0]);
const members = await client.rest.teams.listMembersInOrg({
org: org,
team_slug: teams[0],
});
console.log(
'Request Status for getting team members:' + members.status,
);
// filter out PR author
const eligibleMembers = members.data
.filter((user) => user.login !== pull.data.user?.login)
.map((a) => a.login);
console.log('Picking reviewer from eligible members:', eligibleMembers);
const person = [
eligibleMembers[Math.floor(Math.random() * eligibleMembers.length)],
];
const personResponse = await client.rest.pulls.requestReviewers({
owner: issue.owner,
repo: issue.repo,
pull_number: issue.number,
reviewers: person,
});
console.log(
'Request Status:' +
personResponse.status +
', Person from First Team: ' +
personResponse?.data?.requested_reviewers
?.map((r) => r.login)
.join(','),
);

Incorrect version number in README

The readme example lists,uses: rowi1de/[email protected] which is incorrect. Fixed by changing the v1.0.1 to v.1.0.1.

As is it throws an errror when running the action: An action could not be found at the URI 'https://api.github.com/repos/rowi1de/auto-assign-review-teams/tarball/v1.0.1'

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.