/AutoAddIssue

GitHub Action to auto-add issues from many repos

MIT LicenseMIT

NSIDC logo

GitHub Auto Add Issue

Auto Add Issue is a GitHub workflow that automatically adds issues from a repository to a project when they are created. The workflow can be found at .github/workflows/project-add.yml and needs to be edited to specify the proper project. Additionally, a repository secret with a PAT token with proper scope will need to be added to any repository with this action.

Level of Support

  • This repository is fully supported by NSIDC. If you discover any problems or bugs, please submit an Issue. If you would like to contribute to this repository, you may fork the repository and submit a pull request.
  • This repository is not actively supported by NSIDC but we welcome issue submissions and pull requests in order to foster community contribution.

See the LICENSE for details on permissions and warranties. Please contact nsidc@nsidc.org for more information.

Requirements

  • Access to repository workflows
  • PAT token with access to repositories
  • Access to create GitHub Secret Variables

Installation

To install this GitHub workflow into a repository, copy the file .github/workflows/project-add.yml into the folder .github/workflows/ of your repository of choice. Then edit it with the Usage instructions below.

Usage

This GitHub Workflow uses the add-to-project GitHub Action.
To use this workflow, you need to edit the project-url and add a PAT token with a repository secret to the repository (see more below).

project-url in project-add.yml

Access the file project-add.yml and edit the variable (marked with comments toward the bottom of the page) project-url. You just need to replace the dummy text with a URL of the form https://github.com/orgs/<org name>/projects/<project number> or https://github.com/users/<GitHub username>/projects/<project number>.

GitHub Repository Secrets

GitHub repositories have secrets that encrypt the data that a user puts in and stores it in a variable. This allows items such as PAT tokens to be put into repositories and securely used by GitHub actions.
To add a repository secret follow these steps:

  1. Go to the repository of choice and go to "Settings"
  2. Find "Secrets and Variables" under the "Security" section
  3. Then "Actions" in the drop-down menu
  4. Add a repository secret named ADD_TO_PROJECT_PAT with the secret as a PAT with project access
    Is this too confusing? See the documentation

GitHub PATs are a way of securely automating repository, project, and issue management. They are strings of random letters and numbers generated by a GitHub user that allow that user to perform actions with GitHub, without the need for manual verification. The user decides the scope or permissions of a PAT before creation and once a token is created, it will have those permissions until it expires (or is deleted).
There are two different types of tokens: fine grain and classic. We will need to use a classic token as the action add-to-project does not support fine-grain tokens.
This token needs to have project scope access.
Note: For private repositories, a PAT with project and repo access will need to be the secret to allow issue transferring.
See creating a PAT token for help in creating a GitHub PAT token.

Finally, add the PAT token to the project as a secret with the steps above or this more in-depth guide.

Customization

Currently, any repository that has this workflow set up will add any issue to the project of choice if the issue is opened, reopened, or transferred.
This can be changed by changing the types, marked in project-add.yml with comments.
The currently supported options for the add-to-project GitHub action are opened, reopened, transferred, and labeled.

For more information about dealing with projects with labels, see the add-to-project documentation to customize adding issues with certain labels to projects.

Credit

This content was developed by the National Snow and Ice Data Center with funding from multiple sources.