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?
However, GitHub apps are essentially deprecated at this point, as they've been superseded by GitHub actions. In this post I show how you can install a GitHub action workflow into your repository that automatically assigns new issues to specific users. Why do you need this?
You can add issues and pull requests to a project board in the form of cards and triage them into columns. Note: Projects (beta), the all-new projects experience, is now available. For more information about projects (beta), see " About projects (beta) ." You can add issue or pull request cards to your project board by:
I'm not going to go into detail about GitHub actions here, but in short, GitHub actions allows you to run code when an event happens in your GitHub repository. One of the most common events is for a push to your repository, so you can use GitHub actions for running continuous integration builds of your application.
This is an easy one to test, simply create a test issue in your repository! When you do, you won't see the issue assigned immediately, but if you check the Actions tab, you'll see that the "Issue assignment" workflow is running: After a few seconds or so, you should see the workflow has turned green.
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
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
and project
scopes (as of v0.1.0).
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!
I managed to make it work using this workflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With