'Github - Auto assign Issue to Project

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



Solution 1:[1]

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

Solution 2:[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!

Solution 3:[3]

For the new beta projects, there's now an official action to add issues and pull requests: actions/add-to-project. It's "in beta, however the API is stable".

Using the action looks roughly like

      - uses: actions/add-to-project@main
        with:
          project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
          github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
          labeled: bug, needs-triage
          label-operator: OR

where the token requires repo, write:org, and read:org scopes.

Solution 4:[4]

I managed to make it work using this workflow.

Solution 5:[5]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 peterevans
Solution 2 reymon359
Solution 3 Benjamin W.
Solution 4 DottoreM
Solution 5 VonC