Skip to content

Assign an issue or a pull request to the organization project

License

Notifications You must be signed in to change notification settings

KekeHub/auto-assign-project

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Auto Assign Project

CI GitHub Marketplace Mergify Status

A GitHub Action that assignes an issue or a pull requests to a organization or user project (currently beta).

Usage

This is the basic usage.

on:
  issues: [opened]
  pull_request: [opened]

steps:
    - name: Assign issue to organization project
      uses: KekeHub/auto-assign-project@v1
      with:
        token: ${{ secrets.MY_GITHUB_TOKEN }}

Note that this can be used for either organization or user projects. Please see the following sections for details.

Authorization

The default workflow GitHub token ${{ secrtes.GITHUB_TOKEN }} doesn't have enough permissions so you need to create a GitHub PAT or a GitHub App. There are two ways to setup the client credentials.

GitHub PAT

Using GitHub PAT

Please create a PAT with the following permissions.

  • repo
  • admin:org

Then pass it thought the token arguments.

steps:
    - name: Assign issue to organization project
      uses: KekeHub/auto-assign-project@v1
      with:
        token: ${{ secrets.MY_GITHUB_TOKEN }}

💡 Note that GitHub App described in the next sections has granular permissions and it's strongly recommended.

GitHub App

Using GitHub App

Please create a GitHub App with the following permissions and install to the directory which will refer the issues or the pull requests.

  • Repository
    • Issue: Read only
  • Organization:
    • Project: Read and write

Then pass it thought the GitHub app arguments.

steps:
    - name: Assign issue to organization project
      uses: KekeHub/auto-assign-project@v1
      with:
        app-integration-id: ${{ secrets.MYBOT_INTEGRATION_ID }}
        app-installation-id: ${{ secrets.MYBOT_INSTALLATION_ID }}
        app-private-key: ${{ secrets.MYBOT_PRIVATE_KEY }}

If any of these arguments are missing, the ${{ secrets.GITHUB_TOKEN }} will get used.

Inputs

NAME DESCRIPTION TYPE REQUIRED DEFAULT
app-installation-id ID of the GitHub App installation to your organization. number false
app-integration-id ID of the GiHub App a.k.a App ID number false
app-private-key Private key of the GitHub App. string false
issue-id ID of the issue. string true ${{ github.event.issue.node_id }} or ${{ github.event.pull_request.node_id }}
owner Organization or the user e.g. KekeHub string false The workflows GitHub organization
token A GitHub token. If GitHub App arguments are configured, this argument will be ignored. string false ${{ github.token }}
project-id ID (Number) of the project. e.g.) 1 number true

Outputs

NAME DESCRIPTION TYPE
project-item-id ID of the item (issue or pull request) that was added to the project. Useful for later use if you want to update the fields. You can use KekeHub/update-project-item-fields to update the fields. string

Related Actions

License

MIT