mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-11 20:47:05 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0af0b18f28 | ||
|
|
c8dd399614 | ||
|
|
f111c2aa36 | ||
|
|
12e917e04c | ||
|
|
dbe00218fb | ||
|
|
fa0b958991 | ||
|
|
f343062b82 | ||
|
|
e639bba4f0 | ||
|
|
34ff2c7db4 | ||
|
|
4065956be9 | ||
|
|
9b0fd13e3f | ||
|
|
53d95574f4 | ||
|
|
31c3cce717 | ||
|
|
c1795be3bc | ||
|
|
75ae529d21 | ||
|
|
93eba4a2e5 | ||
|
|
5582d9894f | ||
|
|
97e01d66ef | ||
|
|
2a4deb3f9f | ||
|
|
458653506b | ||
|
|
322721b8cd | ||
|
|
601b150078 | ||
|
|
665443b5d9 | ||
|
|
caae605ffb | ||
|
|
5d3a082e24 | ||
|
|
80b198ce77 | ||
|
|
92eaaeabac | ||
|
|
8eedaeb3f8 | ||
|
|
3b83e6acf9 | ||
|
|
0bf2f64851 | ||
|
|
ce9d751c8c | ||
|
|
2b841e5b72 | ||
|
|
7ca6a73a54 | ||
|
|
79db2f4851 | ||
|
|
cf1add2ac3 | ||
|
|
50a0a4c60e | ||
|
|
ed9ec99956 | ||
|
|
79316c3c93 | ||
|
|
2914167b9b | ||
|
|
53101abf47 | ||
|
|
0c1e36ed75 | ||
|
|
1664cea4b1 | ||
|
|
58dc7efeb3 | ||
|
|
8bc56cd807 |
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -18,3 +18,5 @@ jobs:
|
|||||||
npm install
|
npm install
|
||||||
- run: |
|
- run: |
|
||||||
npm run build
|
npm run build
|
||||||
|
- run: |
|
||||||
|
npm run test
|
||||||
|
|||||||
4
.licenses/npm/@actions/core.dep.yml
generated
4
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: '@actions/core'
|
||||||
version: 1.9.0
|
version: 1.9.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |-
|
text: |-
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
|||||||
4
.licenses/npm/@actions/github.dep.yml
generated
4
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/github"
|
name: '@actions/github'
|
||||||
version: 5.0.3
|
version: 5.0.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions github lib
|
summary: Actions github lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |-
|
text: |-
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
|||||||
4
.licenses/npm/@actions/http-client.dep.yml
generated
4
.licenses/npm/@actions/http-client.dep.yml
generated
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/http-client"
|
name: '@actions/http-client'
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions Http Client
|
summary: Actions Http Client
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
text: |
|
text: |
|
||||||
Actions Http Client for Node.js
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
|||||||
8
.licenses/npm/@octokit/core.dep.yml
generated
8
.licenses/npm/@octokit/core.dep.yml
generated
@@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/core"
|
name: '@octokit/core'
|
||||||
version: 3.6.0
|
version: 3.6.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||||
homepage:
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
text: |
|
text: |
|
||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
@@ -29,6 +29,6 @@ licenses:
|
|||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
82
README.md
82
README.md
@@ -1,17 +1,15 @@
|
|||||||
# actions/add-to-project
|
# actions/add-to-project
|
||||||
|
|
||||||
Use this action to automatically add the current issue or pull request to a GitHub project.
|
Use this action to automatically add the current issue or pull request to a [GitHub project](https://docs.github.com/en/issues/trying-out-the-new-projects-experience/about-projects).
|
||||||
Note that this is for [GitHub projects
|
Note that this action does not support [GitHub projects (classic)](https://docs.github.com/en/issues/organizing-your-work-with-project-boards).
|
||||||
(beta)](https://docs.github.com/en/issues/trying-out-the-new-projects-experience/about-projects),
|
|
||||||
not the original GitHub projects.
|
|
||||||
|
|
||||||
## Current Status
|
## Current Status
|
||||||
|
|
||||||
[](https://github.com/actions/add-to-project/actions/workflows/test.yml)
|
[](https://github.com/actions/add-to-project/actions/workflows/test.yml)
|
||||||
|
|
||||||
🚨 **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** 🚨
|
> **NOTE:** This Action (currently) only supports auto-adding Issues/Pull Requests to a Project which lives in the same organization as your target Repository.
|
||||||
|
|
||||||
> **NOTE:** This Action (currently) only supports auto-adding Issues to a Project which lives in the same organization as your target Repository.
|
> **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.5](https://github.com/actions/add-to-project/releases/tag/v0.0.5).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -23,7 +21,9 @@ Create a workflow that runs when Issues or Pull Requests are opened or labeled i
|
|||||||
|
|
||||||
Once you've configured your workflow, save it as a `.yml` file in your target Repository's `.github/workflows` directory.
|
Once you've configured your workflow, save it as a `.yml` file in your target Repository's `.github/workflows` directory.
|
||||||
|
|
||||||
##### Example Usage: Issue opened with labels `bug` OR `needs-triage`
|
### Examples
|
||||||
|
|
||||||
|
#### Example Usage: Issue opened with labels `bug` OR `needs-triage`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Add bugs to bugs project
|
name: Add bugs to bugs project
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
name: Add issue to project
|
name: Add issue to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@main
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
with:
|
with:
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
label-operator: OR
|
label-operator: OR
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 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`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Adds all issues that don't include the 'bug' or 'needs-triage' labels to project board
|
name: Adds all issues that don't include the 'bug' or 'needs-triage' labels to project board
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
name: Add issue to project
|
name: Add issue to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@main
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
with:
|
with:
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
@@ -69,7 +69,7 @@ jobs:
|
|||||||
label-operator: NOT
|
label-operator: NOT
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Example Usage: Pull Requests labeled with `needs-review` and `size/XL`
|
#### Example Usage: Pull Requests labeled with `needs-review` and `size/XL`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Add needs-review and size/XL pull requests to projects
|
name: Add needs-review and size/XL pull requests to projects
|
||||||
@@ -84,7 +84,7 @@ jobs:
|
|||||||
name: Add issue to project
|
name: Add issue to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@main
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
with:
|
with:
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
@@ -92,22 +92,29 @@ jobs:
|
|||||||
label-operator: AND
|
label-operator: AND
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Further reading and additional resources
|
### Further reading and additional resources
|
||||||
|
|
||||||
- [Inputs](#inputs)
|
- [actions/add-to-project](#actionsadd-to-project)
|
||||||
- [Supported Events](#supported-events)
|
- [Current Status](#current-status)
|
||||||
- [How to point the action to a specific branch or commit sha](#how-to-point-the-action-to-a-specific-branch-or-commit-sha)
|
- [Usage](#usage)
|
||||||
- [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository)
|
- [Examples](#examples)
|
||||||
- [Development](#development)
|
- [Example Usage: Issue opened with labels `bug` OR `needs-triage`](#example-usage-issue-opened-with-labels-bug-or-needs-triage)
|
||||||
- [Publish to a distribution branch](#publish-to-a-distribution-branch)
|
- [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)
|
||||||
|
- [Example Usage: Pull Requests labeled with `needs-review` and `size/XL`](#example-usage-pull-requests-labeled-with-needs-review-and-sizexl)
|
||||||
|
- [Further reading and additional resources](#further-reading-and-additional-resources)
|
||||||
|
- [Inputs](#inputs)
|
||||||
|
- [Supported Events](#supported-events)
|
||||||
|
- [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository)
|
||||||
|
- [Development](#development)
|
||||||
|
- [Publish to a distribution branch](#publish-to-a-distribution-branch)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- <a name="project-url">`project-url`</a> **(required)** is the URL of the GitHub project to add issues to.
|
- <a name="project-url">`project-url`</a> **(required)** is the URL of the GitHub project to add issues to.
|
||||||
_eg: `https://github.com/orgs|users/<ownerName>/projects/<projectNumber>`_
|
_eg: `https://github.com/orgs|users/<ownerName>/projects/<projectNumber>`_
|
||||||
- <a name="github-token">`github-token`</a> **(required)** is a [personal access
|
- <a name="github-token">`github-token`</a> **(required)** is a [personal access
|
||||||
token](https://github.com/settings/tokens/new) with the `repo`, `write:org` and
|
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes.
|
||||||
`read:org` scopes.
|
|
||||||
_See [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository) for more details_
|
_See [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository) for more details_
|
||||||
- <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.
|
- <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.
|
||||||
- <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`.
|
- <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,41 +134,10 @@ and the following [`pull_request` events](https://docs.github.com/en/actions/usi
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
## How to point the action to a specific branch or commit sha
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
add-to-project:
|
|
||||||
name: Add issue to project
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/add-to-project@main
|
|
||||||
with:
|
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
|
||||||
```
|
|
||||||
|
|
||||||
Another option would be to point to a full [commit SHA](https://docs.github.com/en/get-started/quickstart/github-glossary#commit):
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
jobs:
|
|
||||||
add-to-project:
|
|
||||||
name: Add issue to project
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/add-to-project@<commitSHA>
|
|
||||||
with:
|
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Creating a PAT and adding it to your repository
|
## Creating a PAT and adding it to your repository
|
||||||
|
|
||||||
- create a new [personal access
|
- create a new [personal access
|
||||||
token](https://github.com/settings/tokens/new) with `repo`, `write:org` and
|
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes
|
||||||
`read:org` scopes
|
|
||||||
_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_
|
_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_
|
||||||
|
|
||||||
- add the newly created PAT as a repository secret, this secret will be referenced by the [github-token input](#github-token)
|
- add the newly created PAT as a repository secret, this secret will be referenced by the [github-token input](#github-token)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
|
|
||||||
import {addToProject, mustGetOwnerTypeQuery} from '../src/add-to-project'
|
import {addToProject, mustGetOwnerTypeQuery} from '../src/add-to-project'
|
||||||
|
|
||||||
describe('addToProject', () => {
|
describe('addToProject', () => {
|
||||||
@@ -29,18 +30,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +50,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('adds matching issues with a label filter without label-operator', async () => {
|
test('adds matching issues with a label filter without label-operator', async () => {
|
||||||
@@ -71,18 +72,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('adds matching pull-requests with a label filter without label-operator', async () => {
|
test('adds matching pull-requests with a label filter without label-operator', async () => {
|
||||||
@@ -114,18 +115,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,7 +135,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('does not add un-matching issues with a label filter without label-operator', async () => {
|
test('does not add un-matching issues with a label filter without label-operator', async () => {
|
||||||
@@ -178,18 +179,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +199,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('does not add un-matching issues with labels filter with AND label-operator', async () => {
|
test('does not add un-matching issues with labels filter with AND label-operator', async () => {
|
||||||
@@ -265,17 +266,17 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-next-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-next-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -307,18 +308,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,7 +332,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
expect(gqlMock).toHaveBeenCalled()
|
expect(gqlMock).toHaveBeenCalled()
|
||||||
expect(infoSpy).not.toHaveBeenCalled()
|
expect(infoSpy).not.toHaveBeenCalled()
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('does not add un-matching issues with multiple label filters', async () => {
|
test('does not add un-matching issues with multiple label filters', async () => {
|
||||||
@@ -377,18 +378,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +402,7 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
expect(gqlMock).toHaveBeenCalled()
|
expect(gqlMock).toHaveBeenCalled()
|
||||||
expect(infoSpy).not.toHaveBeenCalled()
|
expect(infoSpy).not.toHaveBeenCalled()
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test(`throws an error when url isn't a valid project url`, async () => {
|
test(`throws an error when url isn't a valid project url`, async () => {
|
||||||
@@ -467,18 +468,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -512,18 +513,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,17 +559,17 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-next-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-next-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Add To GitHub Projects Beta
|
name: Add To GitHub projects
|
||||||
description: Automatically add issues and PRs to GitHub projects beta
|
description: Automatically add issues and PRs to GitHub projects
|
||||||
author: GitHub
|
author: GitHub
|
||||||
branding:
|
branding:
|
||||||
icon: table
|
icon: table
|
||||||
|
|||||||
16
dist/index.js
generated
vendored
16
dist/index.js
generated
vendored
@@ -93,7 +93,7 @@ function addToProject() {
|
|||||||
// First, use the GraphQL API to request the project's node ID.
|
// First, use the GraphQL API to request the project's node ID.
|
||||||
const idResp = yield octokit.graphql(`query getProject($ownerName: String!, $projectNumber: Int!) {
|
const idResp = yield octokit.graphql(`query getProject($ownerName: String!, $projectNumber: Int!) {
|
||||||
${ownerTypeQuery}(login: $ownerName) {
|
${ownerTypeQuery}(login: $ownerName) {
|
||||||
projectNext(number: $projectNumber) {
|
projectV2(number: $projectNumber) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,24 +101,24 @@ function addToProject() {
|
|||||||
ownerName,
|
ownerName,
|
||||||
projectNumber
|
projectNumber
|
||||||
});
|
});
|
||||||
const projectId = (_h = idResp[ownerTypeQuery]) === null || _h === void 0 ? void 0 : _h.projectNext.id;
|
const projectId = (_h = idResp[ownerTypeQuery]) === null || _h === void 0 ? void 0 : _h.projectV2.id;
|
||||||
const contentId = issue === null || issue === void 0 ? void 0 : issue.node_id;
|
const contentId = issue === null || issue === void 0 ? void 0 : issue.node_id;
|
||||||
core.debug(`Project node ID: ${projectId}`);
|
core.debug(`Project node ID: ${projectId}`);
|
||||||
core.debug(`Content ID: ${contentId}`);
|
core.debug(`Content ID: ${contentId}`);
|
||||||
// Next, use the GraphQL API to add the issue to the project.
|
// Next, use the GraphQL API to add the issue to the project.
|
||||||
const addResp = yield octokit.graphql(`mutation addIssueToProject($input: AddProjectNextItemInput!) {
|
const addResp = yield octokit.graphql(`mutation addIssueToProject($input: AddProjectV2ItemByIdInput!) {
|
||||||
addProjectNextItem(input: $input) {
|
addProjectV2ItemById(input: $input) {
|
||||||
projectNextItem {
|
item {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`, {
|
}`, {
|
||||||
input: {
|
input: {
|
||||||
contentId,
|
projectId,
|
||||||
projectId
|
contentId
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
core.setOutput('itemId', addResp.addProjectNextItem.projectNextItem.id);
|
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.addToProject = addToProject;
|
exports.addToProject = addToProject;
|
||||||
|
|||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
166
package-lock.json
generated
166
package-lock.json
generated
@@ -15,14 +15,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@github/prettier-config": "^0.0.4",
|
"@github/prettier-config": "^0.0.4",
|
||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/node": "~16.11.41",
|
"@types/node": "~16.11.45",
|
||||||
"@typescript-eslint/parser": "^5.29.0",
|
"@typescript-eslint/parser": "^5.30.7",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"concurrently": "^7.2.2",
|
"concurrently": "^7.3.0",
|
||||||
"eslint": "^8.18.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-plugin-github": "^4.3.6",
|
"eslint-plugin-github": "^4.3.6",
|
||||||
"eslint-plugin-jest": "^26.5.3",
|
"eslint-plugin-jest": "^26.6.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
"ts-jest": "^27.1.4",
|
"ts-jest": "^27.1.4",
|
||||||
@@ -1367,9 +1367,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "16.11.41",
|
"version": "16.11.45",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.41.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz",
|
||||||
"integrity": "sha512-mqoYK2TnVjdkGk8qXAVGc/x9nSaTpSrFaGFm43BUH3IdoBV0nta6hYaGmdOvIMlbHJbUEVen3gvwpwovAZKNdQ==",
|
"integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/prettier": {
|
"node_modules/@types/prettier": {
|
||||||
@@ -1448,14 +1448,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.7.tgz",
|
||||||
"integrity": "sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==",
|
"integrity": "sha512-Rg5xwznHWWSy7v2o0cdho6n+xLhK2gntImp0rJroVVFkcYFYQ8C8UJTSuTw/3CnExBmPjycjmUJkxVmjXsld6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.29.0",
|
"@typescript-eslint/scope-manager": "5.30.7",
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.29.0",
|
"@typescript-eslint/typescript-estree": "5.30.7",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -1475,13 +1475,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.7.tgz",
|
||||||
"integrity": "sha512-etbXUT0FygFi2ihcxDZjz21LtC+Eps9V2xVx09zFoN44RRHPrkMflidGMI+2dUs821zR1tDS6Oc9IXxIjOUZwA==",
|
"integrity": "sha512-7BM1bwvdF1UUvt+b9smhqdc/eniOnCKxQT/kj3oXtj3LqnTWCAM0qHRHfyzCzhEfWX0zrW7KqXXeE4DlchZBKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.29.0"
|
"@typescript-eslint/visitor-keys": "5.30.7"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@@ -1492,9 +1492,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.7.tgz",
|
||||||
"integrity": "sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==",
|
"integrity": "sha512-ocVkETUs82+U+HowkovV6uxf1AnVRKCmDRNUBUUo46/5SQv1owC/EBFkiu4MOHeZqhKz2ktZ3kvJJ1uFqQ8QPg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@@ -1505,13 +1505,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.7.tgz",
|
||||||
"integrity": "sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==",
|
"integrity": "sha512-tNslqXI1ZdmXXrHER83TJ8OTYl4epUzJC0aj2i4DMDT4iU+UqLT3EJeGQvJ17BMbm31x5scSwo3hPM0nqQ1AEA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.29.0",
|
"@typescript-eslint/visitor-keys": "5.30.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -1532,12 +1532,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.7.tgz",
|
||||||
"integrity": "sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==",
|
"integrity": "sha512-KrRXf8nnjvcpxDFOKej4xkD7657+PClJs5cJVSG7NNoCNnjEdc46juNAQt7AyuWctuCgs6mVRc1xGctEqrjxWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"eslint-visitor-keys": "^3.3.0"
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -2263,9 +2263,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/concurrently": {
|
"node_modules/concurrently": {
|
||||||
"version": "7.2.2",
|
"version": "7.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz",
|
||||||
"integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==",
|
"integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
@@ -2659,9 +2659,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.18.0",
|
"version": "8.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.20.0.tgz",
|
||||||
"integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==",
|
"integrity": "sha512-d4ixhz5SKCa1D6SCPrivP7yYVi7nyD6A4vs6HIAul9ujBzcEmZVM3/0NN/yu5nKhmO1wjp5xQ46iRfmDGlOviA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/eslintrc": "^1.3.0",
|
"@eslint/eslintrc": "^1.3.0",
|
||||||
@@ -2901,9 +2901,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-jest": {
|
"node_modules/eslint-plugin-jest": {
|
||||||
"version": "26.5.3",
|
"version": "26.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.6.0.tgz",
|
||||||
"integrity": "sha512-sICclUqJQnR1bFRZGLN2jnSVsYOsmPYYnroGCIMVSvTS3y8XR3yjzy1EcTQmk6typ5pRgyIWzbjqxK6cZHEZuQ==",
|
"integrity": "sha512-f8n46/97ZFdU4KqeQYqO8AEVGIhHWvkpgNBWHH3jrM28/y8llnbf3IjfIKv6p2pZIMinK1PCqbbROxs9Eud02Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/utils": "^5.10.0"
|
"@typescript-eslint/utils": "^5.10.0"
|
||||||
@@ -2934,15 +2934,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint-plugin-prettier": {
|
"node_modules/eslint-plugin-prettier": {
|
||||||
"version": "4.0.0",
|
"version": "4.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
|
||||||
"integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==",
|
"integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"prettier-linter-helpers": "^1.0.0"
|
"prettier-linter-helpers": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=12.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": ">=7.28.0",
|
"eslint": ">=7.28.0",
|
||||||
@@ -7577,9 +7577,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "16.11.41",
|
"version": "16.11.45",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.41.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.45.tgz",
|
||||||
"integrity": "sha512-mqoYK2TnVjdkGk8qXAVGc/x9nSaTpSrFaGFm43BUH3IdoBV0nta6hYaGmdOvIMlbHJbUEVen3gvwpwovAZKNdQ==",
|
"integrity": "sha512-3rKg/L5x0rofKuuUt5zlXzOnKyIHXmIu5R8A0TuNDMF2062/AOIDBciFIjToLEJ/9F9DzkHNot+BpNsMI1OLdQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/prettier": {
|
"@types/prettier": {
|
||||||
@@ -7638,41 +7638,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.30.7.tgz",
|
||||||
"integrity": "sha512-ruKWTv+x0OOxbzIw9nW5oWlUopvP/IQDjB5ZqmTglLIoDTctLlAJpAQFpNPJP/ZI7hTT9sARBosEfaKbcFuECw==",
|
"integrity": "sha512-Rg5xwznHWWSy7v2o0cdho6n+xLhK2gntImp0rJroVVFkcYFYQ8C8UJTSuTw/3CnExBmPjycjmUJkxVmjXsld6A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/scope-manager": "5.29.0",
|
"@typescript-eslint/scope-manager": "5.30.7",
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/typescript-estree": "5.29.0",
|
"@typescript-eslint/typescript-estree": "5.30.7",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": {
|
"@typescript-eslint/scope-manager": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.30.7.tgz",
|
||||||
"integrity": "sha512-etbXUT0FygFi2ihcxDZjz21LtC+Eps9V2xVx09zFoN44RRHPrkMflidGMI+2dUs821zR1tDS6Oc9IXxIjOUZwA==",
|
"integrity": "sha512-7BM1bwvdF1UUvt+b9smhqdc/eniOnCKxQT/kj3oXtj3LqnTWCAM0qHRHfyzCzhEfWX0zrW7KqXXeE4DlchZBKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.29.0"
|
"@typescript-eslint/visitor-keys": "5.30.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/types": {
|
"@typescript-eslint/types": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.30.7.tgz",
|
||||||
"integrity": "sha512-X99VbqvAXOMdVyfFmksMy3u8p8yoRGITgU1joBJPzeYa0rhdf5ok9S56/itRoUSh99fiDoMtarSIJXo7H/SnOg==",
|
"integrity": "sha512-ocVkETUs82+U+HowkovV6uxf1AnVRKCmDRNUBUUo46/5SQv1owC/EBFkiu4MOHeZqhKz2ktZ3kvJJ1uFqQ8QPg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.30.7.tgz",
|
||||||
"integrity": "sha512-mQvSUJ/JjGBdvo+1LwC+GY2XmSYjK1nAaVw2emp/E61wEVYEyibRHCqm1I1vEKbXCpUKuW4G7u9ZCaZhJbLoNQ==",
|
"integrity": "sha512-tNslqXI1ZdmXXrHER83TJ8OTYl4epUzJC0aj2i4DMDT4iU+UqLT3EJeGQvJ17BMbm31x5scSwo3hPM0nqQ1AEA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"@typescript-eslint/visitor-keys": "5.29.0",
|
"@typescript-eslint/visitor-keys": "5.30.7",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@@ -7681,12 +7681,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/visitor-keys": {
|
"@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.29.0",
|
"version": "5.30.7",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.29.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.30.7.tgz",
|
||||||
"integrity": "sha512-Hpb/mCWsjILvikMQoZIE3voc9wtQcS0A9FUw3h8bhr9UxBdtI/tw1ZDZUOXHXLOVMedKCH5NxyzATwnU78bWCQ==",
|
"integrity": "sha512-KrRXf8nnjvcpxDFOKej4xkD7657+PClJs5cJVSG7NNoCNnjEdc46juNAQt7AyuWctuCgs6mVRc1xGctEqrjxWw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "5.29.0",
|
"@typescript-eslint/types": "5.30.7",
|
||||||
"eslint-visitor-keys": "^3.3.0"
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -8204,9 +8204,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"concurrently": {
|
"concurrently": {
|
||||||
"version": "7.2.2",
|
"version": "7.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz",
|
||||||
"integrity": "sha512-DcQkI0ruil5BA/g7Xy3EWySGrFJovF5RYAYxwGvv9Jf9q9B1v3jPFP2tl6axExNf1qgF30kjoNYrangZ0ey4Aw==",
|
"integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
@@ -8504,9 +8504,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "8.18.0",
|
"version": "8.20.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.18.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.20.0.tgz",
|
||||||
"integrity": "sha512-As1EfFMVk7Xc6/CvhssHUjsAQSkpfXvUGMFC3ce8JDe6WvqCgRrLOBQbVpsBFr1X1V+RACOadnzVvcUS5ni2bA==",
|
"integrity": "sha512-d4ixhz5SKCa1D6SCPrivP7yYVi7nyD6A4vs6HIAul9ujBzcEmZVM3/0NN/yu5nKhmO1wjp5xQ46iRfmDGlOviA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint/eslintrc": "^1.3.0",
|
"@eslint/eslintrc": "^1.3.0",
|
||||||
@@ -8759,9 +8759,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-jest": {
|
"eslint-plugin-jest": {
|
||||||
"version": "26.5.3",
|
"version": "26.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-26.6.0.tgz",
|
||||||
"integrity": "sha512-sICclUqJQnR1bFRZGLN2jnSVsYOsmPYYnroGCIMVSvTS3y8XR3yjzy1EcTQmk6typ5pRgyIWzbjqxK6cZHEZuQ==",
|
"integrity": "sha512-f8n46/97ZFdU4KqeQYqO8AEVGIhHWvkpgNBWHH3jrM28/y8llnbf3IjfIKv6p2pZIMinK1PCqbbROxs9Eud02Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/utils": "^5.10.0"
|
"@typescript-eslint/utils": "^5.10.0"
|
||||||
@@ -8774,9 +8774,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint-plugin-prettier": {
|
"eslint-plugin-prettier": {
|
||||||
"version": "4.0.0",
|
"version": "4.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
|
||||||
"integrity": "sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==",
|
"integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"prettier-linter-helpers": "^1.0.0"
|
"prettier-linter-helpers": "^1.0.0"
|
||||||
|
|||||||
14
package.json
14
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/add-to-project",
|
"name": "@actions/add-to-project",
|
||||||
"description": "Automatically issues and PRs to GitHub projects",
|
"description": "Automatically adds issues and PRs to GitHub projects",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"author": "GitHub and contributors",
|
"author": "GitHub and contributors",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -14,14 +14,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@github/prettier-config": "^0.0.4",
|
"@github/prettier-config": "^0.0.4",
|
||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/node": "~16.11.41",
|
"@types/node": "~16.11.45",
|
||||||
"@typescript-eslint/parser": "^5.29.0",
|
"@typescript-eslint/parser": "^5.30.7",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"concurrently": "^7.2.2",
|
"concurrently": "^7.3.0",
|
||||||
"eslint": "^8.18.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-plugin-github": "^4.3.6",
|
"eslint-plugin-github": "^4.3.6",
|
||||||
"eslint-plugin-jest": "^26.5.3",
|
"eslint-plugin-jest": "^26.6.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
"ts-jest": "^27.1.4",
|
"ts-jest": "^27.1.4",
|
||||||
|
|||||||
@@ -8,21 +8,21 @@ const urlParse =
|
|||||||
|
|
||||||
interface ProjectNodeIDResponse {
|
interface ProjectNodeIDResponse {
|
||||||
organization?: {
|
organization?: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user?: {
|
user?: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProjectAddItemResponse {
|
interface ProjectAddItemResponse {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,6 +40,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
const labelOperator = core.getInput('label-operator').trim().toLocaleLowerCase()
|
const labelOperator = core.getInput('label-operator').trim().toLocaleLowerCase()
|
||||||
|
|
||||||
const octokit = github.getOctokit(ghToken)
|
const octokit = github.getOctokit(ghToken)
|
||||||
|
|
||||||
const urlMatch = projectUrl.match(urlParse)
|
const urlMatch = projectUrl.match(urlParse)
|
||||||
const issue = github.context.payload.issue ?? github.context.payload.pull_request
|
const issue = github.context.payload.issue ?? github.context.payload.pull_request
|
||||||
const issueLabels: string[] = (issue?.labels ?? []).map((l: {name: string}) => l.name.toLowerCase())
|
const issueLabels: string[] = (issue?.labels ?? []).map((l: {name: string}) => l.name.toLowerCase())
|
||||||
@@ -83,7 +84,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
const idResp = await octokit.graphql<ProjectNodeIDResponse>(
|
const idResp = await octokit.graphql<ProjectNodeIDResponse>(
|
||||||
`query getProject($ownerName: String!, $projectNumber: Int!) {
|
`query getProject($ownerName: String!, $projectNumber: Int!) {
|
||||||
${ownerTypeQuery}(login: $ownerName) {
|
${ownerTypeQuery}(login: $ownerName) {
|
||||||
projectNext(number: $projectNumber) {
|
projectV2(number: $projectNumber) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +95,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const projectId = idResp[ownerTypeQuery]?.projectNext.id
|
const projectId = idResp[ownerTypeQuery]?.projectV2.id
|
||||||
const contentId = issue?.node_id
|
const contentId = issue?.node_id
|
||||||
|
|
||||||
core.debug(`Project node ID: ${projectId}`)
|
core.debug(`Project node ID: ${projectId}`)
|
||||||
@@ -102,22 +103,22 @@ export async function addToProject(): Promise<void> {
|
|||||||
|
|
||||||
// Next, use the GraphQL API to add the issue to the project.
|
// Next, use the GraphQL API to add the issue to the project.
|
||||||
const addResp = await octokit.graphql<ProjectAddItemResponse>(
|
const addResp = await octokit.graphql<ProjectAddItemResponse>(
|
||||||
`mutation addIssueToProject($input: AddProjectNextItemInput!) {
|
`mutation addIssueToProject($input: AddProjectV2ItemByIdInput!) {
|
||||||
addProjectNextItem(input: $input) {
|
addProjectV2ItemById(input: $input) {
|
||||||
projectNextItem {
|
item {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
contentId,
|
projectId,
|
||||||
projectId
|
contentId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
core.setOutput('itemId', addResp.addProjectNextItem.projectNextItem.id)
|
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function mustGetOwnerTypeQuery(ownerType?: string): 'organization' | 'user' {
|
export function mustGetOwnerTypeQuery(ownerType?: string): 'organization' | 'user' {
|
||||||
|
|||||||
Reference in New Issue
Block a user