Files
add-to-project/README.md

76 lines
2.3 KiB
Markdown
Raw Normal View History

2022-01-31 14:09:42 -05:00
# @actions/add-to-project
2022-02-01 22:20:12 +00:00
🚨 **This action is a work in progress. Please do not use it except for
experimentation until a release has been prepared.** 🚨
2022-01-31 14:09:42 -05:00
2022-02-01 22:19:35 +00:00
Use this action to automatically add issues to a GitHub Project. Note that this
is for [GitHub Projects
(beta)](https://docs.github.com/en/issues/trying-out-the-new-projects-experience/about-projects),
not the original GitHub Projects.
To use the action, create a workflow that runs when issues are opened in your
repository. Run this action in a step, optionally configuring any filters you
may want to add, such as only adding issues with certain labels.
2022-01-31 14:09:42 -05:00
```yaml
2022-02-01 22:19:35 +00:00
name: Add bugs to bugs project
2022-01-31 14:09:42 -05:00
on:
2022-02-01 22:19:35 +00:00
issues:
types:
- opened
2022-01-31 14:09:42 -05:00
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1
with:
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
2022-01-31 15:46:31 -05:00
labeled: bug
2022-01-31 14:09:42 -05:00
```
2022-02-01 22:19:35 +00:00
## Inputs
2022-01-31 14:09:42 -05:00
2022-02-01 22:19:35 +00:00
- `project-url` is the URL of the GitHub Project to add issues to.
- `github-token` is a [personal access
token](https://github.com/settings/tokens/new) with the `repo`, `write:org` and
`read:org` scopes.
- `labeled` is a comma-separated list of labels. For an issue to be added to the
project, it must have _one_ of the labels in the list. Omitting this key means
that all issues will be added.
2022-01-31 15:38:31 -05:00
2022-02-01 22:19:35 +00:00
## Development
2022-01-31 14:09:42 -05:00
2022-02-01 22:19:35 +00:00
To get started contributing to this project, clone it and install dependencies.
Note that this action runs in Node.js 12.x, so we recommend using that version
of Node (see "engines" in this action's package.json for details).
2022-01-31 15:38:31 -05:00
2022-02-01 22:19:35 +00:00
```shell
> git clone https://github.com/actions/add-to-project
> cd add-to-project
> npm install
2022-01-31 14:09:42 -05:00
```
2022-02-01 22:19:35 +00:00
Or, use [GitHub Codespaces](https://github.com/features/codespaces).
2022-01-31 14:09:42 -05:00
2022-02-01 22:19:35 +00:00
See the [toolkit
documentation](https://github.com/actions/toolkit/blob/master/README.md#packages)
for the various packages used in building this action.
2022-01-31 14:09:42 -05:00
## Publish to a distribution branch
2022-02-01 22:19:35 +00:00
Actions are run from GitHub repositories, so we check in the packaged action in
the "dist/" directory.
2022-01-31 14:09:42 -05:00
2022-02-01 22:19:35 +00:00
```shell
> npm run build
> git add lib dist
> git commit -a -m "Build and package"
> git push origin releases/v1
2022-01-31 14:09:42 -05:00
```
2022-02-01 22:19:35 +00:00
Now, a release can be created from the branch containing the built action.