19

I would like to Auto Assign an issue to a project in Github. Basically automate the below screenshot for every issue automatically opened. Any ideas?

enter image description here

reymon359
  • 1,240
  • 2
  • 11
  • 34
DottoreM
  • 309
  • 6
  • 27

5 Answers5

18

There are two natively supported options:

  • There's an official action to add issues and pull requests to projects (as opposed to the legacy "classic" projects): actions/add-to-project.

    Using the action looks roughly like

          - uses: actions/add-to-project@v0.4.1
            with:
              project-url: https://github.com/orgs/{org}/projects/{number}
              github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
              labeled: bug, needs-triage
              label-operator: OR
    

    where the token requires repo and project scopes (as of v0.1.0).

  • Issues can be added via an "Auto-add to project" workflow configured in the project itself; this was an Enterprise beta feature in January 2023, and became generally available in March 2023.

    You can add only one repository per workflow, and the number of workflows is limited: 1 for free accounts, 5 for Pro/Team, and 20 for Enterprise. If you need more than that, you have to use the action.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
  • This should really be the accepted answer now - tried both options above without any luck and wish I saw this sooner! Also, I found that it only requires the `repo`, and `project` scopes, not `write:org` or `read:org`. – Alex Koshy Jun 29 '22 at 04:49
  • @AlexKoshy Oh, right, that has changed for v0.1.0, updated [yesterday](https://github.com/actions/add-to-project/commit/79db2f4851878b8779f4d177b44914bdef9ece2c)! I'll update, thanks for pointing it out. – Benjamin W. Jun 29 '22 at 13:23
6

You can use create-or-update-project-card to achieve this.

on:
  issues:
    types: [opened]
jobs:
  createCard:
    runs-on: ubuntu-latest
    steps:
      - name: Create or Update Project Card
        uses: peter-evans/create-or-update-project-card@v1
        with:
          project-name: My project
          column-name: My column
peterevans
  • 34,297
  • 7
  • 84
  • 83
2

There is an app Project Bot to automate this because right now it seems like it is not possible to do so with just the GitHub project configuration.

Here is the Project Bot description from it's repo

This bot will automatically add new Issues or Pull Requests to a Project board based on specially formatted Cards in each Column of a Project. It also allows you to customize the rules for moving Issues between Columns.

Here is the project-bot repo: https://github.com/philschatz/project-bot

I hope it helps!

reymon359
  • 1,240
  • 2
  • 11
  • 34
1

I managed to make it work using this workflow.

DottoreM
  • 309
  • 6
  • 27
0

Check out the Sept. 2021 post "New code review assignment settings and team filtering improvements"

It refers to "Managing code review assignment for your team", which includes:

Routing algorithms

Code review assignments automatically choose and assign reviewers based on one of two possible algorithms.

  • The round robin algorithm chooses reviewers based on who's received the least recent review request, focusing on alternating between all members of the team regardless of the number of outstanding reviews they currently have.

  • The load balance algorithm chooses reviewers based on each member's total number of recent review requests and considers the number of outstanding reviews for each member.
    The load balance algorithm tries to ensure that each team member reviews an equal number of pull requests in any 30 day period.

And now:

New settings give teams more control over the behavior:

  • Limit assignment to only direct members of the team. Previously, team review requests could be assigned to direct members of the team or members of child teams.

  • Continue with automatic assignment even if one or more members of the team are already requested. Previously, a team member who was already requested would be counted as one of the team's automatic review requests.

  • Keep a team assigned to review even if one or more members is newly assigned. Previously, the team review request was always replaced by one or more individual review requests. This would make it difficult to find pull requests where a specific team was requested.

Code review assignments settings can be managed under Team settings > Code review assignment:

https://i2.wp.com/user-images.githubusercontent.com/2503052/134927199-77fbb389-bd6a-46c4-8313-9616683694f6.png?ssl=1

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250