Skip to content

Commit 2b841e5

Browse files
authored
Merge pull request #105 from lukewar/graphql/projectv2
Update Action to use new ProjectsV2 api
2 parents 7334092 + 7ca6a73 commit 2b841e5

File tree

10 files changed

+167
-187
lines changed

10 files changed

+167
-187
lines changed

.licenses/npm/@actions/core.dep.yml

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.licenses/npm/@actions/github.dep.yml

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.licenses/npm/@actions/http-client.dep.yml

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.licenses/npm/@octokit/core.dep.yml

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 30 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ not the original GitHub projects.
99

1010
[![build-test](https://github.com/actions/add-to-project/actions/workflows/test.yml/badge.svg)](https://github.com/actions/add-to-project/actions/workflows/test.yml)
1111

12-
🚨 **This action is in beta, however the API is stable. Some breaking changes might occur between versions, but it is not likely to break as long as you use a specific SHA or version number** 🚨
12+
> **NOTE:** This Action (currently) only supports auto-adding Issues/Pull Requests to a Project which lives in the same organization as your target Repository.
1313
14-
> **NOTE:** This Action (currently) only supports auto-adding Issues to a Project which lives in the same organization as your target Repository.
14+
> **NOTE:** This action no longer uses the deprecated ProjectNext API. If you are looking for the old version of that action, use version [v0.0.3](https://github.com/actions/add-to-project/releases/tag/v0.0.3).
1515
1616
## Usage
1717

@@ -23,7 +23,9 @@ Create a workflow that runs when Issues or Pull Requests are opened or labeled i
2323

2424
Once you've configured your workflow, save it as a `.yml` file in your target Repository's `.github/workflows` directory.
2525

26-
##### Example Usage: Issue opened with labels `bug` OR `needs-triage`
26+
### Examples
27+
28+
#### Example Usage: Issue opened with labels `bug` OR `needs-triage`
2729

2830
```yaml
2931
name: Add bugs to bugs project
@@ -38,15 +40,15 @@ jobs:
3840
name: Add issue to project
3941
runs-on: ubuntu-latest
4042
steps:
41-
- uses: actions/add-to-project@main
43+
- uses: actions/add-to-project@RELEASE_VERSION
4244
with:
4345
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
4446
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
4547
labeled: bug, needs-triage
4648
label-operator: OR
4749
```
4850
49-
##### Example Usage: Adds all issues opened that do not include the label `bug` OR `needs-triage`
51+
#### Example Usage: Adds all issues opened that do not include the label `bug` OR `needs-triage`
5052

5153
```yaml
5254
name: Adds all issues that don't include the 'bug' or 'needs-triage' labels to project board
@@ -61,15 +63,15 @@ jobs:
6163
name: Add issue to project
6264
runs-on: ubuntu-latest
6365
steps:
64-
- uses: actions/add-to-project@main
66+
- uses: actions/add-to-project@RELEASE_VERSION
6567
with:
6668
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
6769
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
6870
labeled: bug, needs-triage
6971
label-operator: NOT
7072
```
7173

72-
##### Example Usage: Pull Requests labeled with `needs-review` and `size/XL`
74+
#### Example Usage: Pull Requests labeled with `needs-review` and `size/XL`
7375

7476
```yaml
7577
name: Add needs-review and size/XL pull requests to projects
@@ -84,30 +86,37 @@ jobs:
8486
name: Add issue to project
8587
runs-on: ubuntu-latest
8688
steps:
87-
- uses: actions/add-to-project@main
89+
- uses: actions/add-to-project@RELEASE_VERSION
8890
with:
8991
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
9092
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
9193
labeled: needs-review, size/XL
9294
label-operator: AND
9395
```
9496

95-
#### Further reading and additional resources
96-
97-
- [Inputs](#inputs)
98-
- [Supported Events](#supported-events)
99-
- [How to point the action to a specific branch or commit sha](#how-to-point-the-action-to-a-specific-branch-or-commit-sha)
100-
- [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository)
101-
- [Development](#development)
102-
- [Publish to a distribution branch](#publish-to-a-distribution-branch)
97+
### Further reading and additional resources
98+
99+
- [actions/add-to-project](#actionsadd-to-project)
100+
- [Current Status](#current-status)
101+
- [Usage](#usage)
102+
- [Examples](#examples)
103+
- [Example Usage: Issue opened with labels `bug` OR `needs-triage`](#example-usage-issue-opened-with-labels-bug-or-needs-triage)
104+
- [Example Usage: Adds all issues opened that do not include the label `bug` OR `needs-triage`](#example-usage-adds-all-issues-opened-that-do-not-include-the-label-bug-or-needs-triage)
105+
- [Example Usage: Pull Requests labeled with `needs-review` and `size/XL`](#example-usage-pull-requests-labeled-with-needs-review-and-sizexl)
106+
- [Further reading and additional resources](#further-reading-and-additional-resources)
107+
- [Inputs](#inputs)
108+
- [Supported Events](#supported-events)
109+
- [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository)
110+
- [Development](#development)
111+
- [Publish to a distribution branch](#publish-to-a-distribution-branch)
112+
- [License](#license)
103113

104114
## Inputs
105115

106-
- <a name="project-url">`project-url`</a> **(required)** is the URL of the GitHub project to add issues to.
116+
- <a name="project-url">`project-url`</a> **(required)** is the URL of the GitHub project to add issues to.
107117
_eg: `https://github.com/orgs|users/<ownerName>/projects/<projectNumber>`_
108118
- <a name="github-token">`github-token`</a> **(required)** is a [personal access
109-
token](https://github.com/settings/tokens/new) with the `repo`, `write:org` and
110-
`read:org` scopes.
119+
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes.
111120
_See [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository) for more details_
112121
- <a name="labeled">`labeled`</a> **(optional)** is a comma-separated list of labels used to filter applicable issues. When this key is provided, an issue must have _one_ of the labels in the list to be added to the project. Omitting this key means that any issue will be added.
113122
- <a name="labeled">`label-operator`</a> **(optional)** is the behavior of the labels filter, either `AND`, `OR` or `NOT` that controls if the issue should be matched with `all` `labeled` input or any of them, default is `OR`.
@@ -127,44 +136,13 @@ and the following [`pull_request` events](https://docs.github.com/en/actions/usi
127136

128137
Using these events ensure that a given issue or pull request, in the workflow's repo, is added to the [specified project](#project-url). If [labeled input(s)](#labeled) are defined, then issues will only be added if they contain at least _one_ of the labels in the list.
129138

130-
## How to point the action to a specific branch or commit sha
131-
132-
Pointing to a branch name generally isn't the safest way to refer to an action, but this is how you can use this action now before we've begun creating releases.
133-
134-
```yaml
135-
jobs:
136-
add-to-project:
137-
name: Add issue to project
138-
runs-on: ubuntu-latest
139-
steps:
140-
- uses: actions/add-to-project@main
141-
with:
142-
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
143-
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
144-
```
145-
146-
Another option would be to point to a full [commit SHA](https://docs.github.com/en/get-started/quickstart/github-glossary#commit):
147-
148-
```yaml
149-
jobs:
150-
add-to-project:
151-
name: Add issue to project
152-
runs-on: ubuntu-latest
153-
steps:
154-
- uses: actions/add-to-project@<commitSHA>
155-
with:
156-
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
157-
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
158-
```
159-
160139
## Creating a PAT and adding it to your repository
161140

162141
- create a new [personal access
163-
token](https://github.com/settings/tokens/new) with `repo`, `write:org` and
164-
`read:org` scopes
142+
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes
165143
_See [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) for more information_
166144

167-
- add the newly created PAT as a repository secret, this secret will be referenced by the [github-token input](#github-token)
145+
- add the newly created PAT as a repository secret, this secret will be referenced by the [github-token input](#github-token)
168146
_See [Encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) for more information_
169147

170148
## Development

0 commit comments

Comments
 (0)