mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-11 20:47:05 +00:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31b3f3ccdc | ||
|
|
039f00e4e1 | ||
|
|
74235d0976 | ||
|
|
5d4ef34b4c | ||
|
|
38a0adc233 | ||
|
|
90818bfeba | ||
|
|
2a9da7be76 | ||
|
|
07c29ba779 | ||
|
|
5b64707bb3 | ||
|
|
321b7eb9bf | ||
|
|
83244eb733 | ||
|
|
fdae002f2c | ||
|
|
c475ba7265 | ||
|
|
7a13e6eeb9 | ||
|
|
7a13494c05 | ||
|
|
a6e07cb1e4 | ||
|
|
9e340dd475 | ||
|
|
0893101300 | ||
|
|
2250fd41d0 | ||
|
|
8a14d78fcf | ||
|
|
a3544f542a | ||
|
|
39569f9b7d | ||
|
|
15db5ef38c | ||
|
|
f6bbaa9eb7 | ||
|
|
88d0700668 | ||
|
|
399442f46a | ||
|
|
e78e561fec | ||
|
|
097fa0553b | ||
|
|
703deace27 | ||
|
|
895720c423 | ||
|
|
b433768232 | ||
|
|
22caa11a6d | ||
|
|
16df187cf9 | ||
|
|
ad9efdf1e6 | ||
|
|
777245737e | ||
|
|
5f4850959b | ||
|
|
4756e6330f | ||
|
|
9f96b16f44 | ||
|
|
5f0c606906 | ||
|
|
11ef9e1e8d | ||
|
|
a28950b59e | ||
|
|
5b15b1a619 | ||
|
|
10934d1d3d | ||
|
|
8434539ee2 | ||
|
|
83567abcd1 | ||
|
|
ba4c19ddac | ||
|
|
2547408f6f | ||
|
|
28a69b27b6 | ||
|
|
ecb32ed323 | ||
|
|
03c85cc34a | ||
|
|
70264bb4d1 | ||
|
|
5a55c0cba5 | ||
|
|
09abe09dcd | ||
|
|
ed88cdc97d | ||
|
|
a173cb1610 | ||
|
|
b6a9b6ff3a | ||
|
|
3f557757a9 | ||
|
|
36391c5bc3 | ||
|
|
b4ca87ff52 | ||
|
|
1fdfb8c67e | ||
|
|
add81c33d2 | ||
|
|
f760b9f1a0 | ||
|
|
bcf48a5d57 | ||
|
|
80b1710843 | ||
|
|
547a49eea1 | ||
|
|
91b8ba84c0 | ||
|
|
247085562b | ||
|
|
99b54d5e6f | ||
|
|
e92b0df91d | ||
|
|
6bf5cd2100 | ||
|
|
aebf7de9ea | ||
|
|
e83ada4abb | ||
|
|
f52b6e4974 | ||
|
|
60ba784944 | ||
|
|
00f7bf6e9b | ||
|
|
41f5c1fa85 | ||
|
|
f64617d938 | ||
|
|
26739f107e | ||
|
|
383f6dfeb4 | ||
|
|
ce1983ff4e | ||
|
|
52f0dde099 | ||
|
|
7d1730801e | ||
|
|
dc0c796a1a | ||
|
|
2abae3f03b | ||
|
|
00a23495f4 | ||
|
|
d19a1438a9 | ||
|
|
1b3c192b00 | ||
|
|
92471ee0d5 | ||
|
|
25580575b4 | ||
|
|
f38a93c5a3 | ||
|
|
f8f1995a9b | ||
|
|
9ce1d75007 | ||
|
|
0c2909c5fd | ||
|
|
dd0961446c | ||
|
|
26f9feae0a | ||
|
|
c261c9a95f | ||
|
|
31901d229d | ||
|
|
0a78e5c8ed | ||
|
|
c4a92acacb | ||
|
|
2ab330cfd5 | ||
|
|
06e54d7eae | ||
|
|
91af7eb93e | ||
|
|
47060e7c7b | ||
|
|
2163ff9e29 | ||
|
|
70ce5a5ec5 | ||
|
|
78711d5ed6 | ||
|
|
a4a63c373b | ||
|
|
b7cc00e404 | ||
|
|
2ca1de6159 | ||
|
|
64a7c52604 | ||
|
|
7540d630bd | ||
|
|
156525c5e2 | ||
|
|
1885da210d | ||
|
|
16a5c31be8 | ||
|
|
29766ca0ac | ||
|
|
fe1b8050dc | ||
|
|
d3e23d39c7 | ||
|
|
e20f3a98a6 | ||
|
|
5a7afe53e1 | ||
|
|
958916895a | ||
|
|
bf580a9c46 | ||
|
|
db7cb0d7f9 | ||
|
|
b6a72217f5 | ||
|
|
686c1a45e0 | ||
|
|
221804fc4f | ||
|
|
b186de4d0e | ||
|
|
75921323e3 | ||
|
|
c41809958a | ||
|
|
42ad4aed60 | ||
|
|
b56b7e6441 |
16
.licenses/npm/@actions/core.dep.yml
generated
16
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
name: '@actions/core'
|
||||
version: 1.10.0
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |-
|
||||
The MIT License (MIT)
|
||||
- sources: LICENSE.md
|
||||
text: |-
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 THE SOFTWARE.
|
||||
notices: []
|
||||
|
||||
2
.licenses/npm/@actions/github.dep.yml
generated
2
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: '@actions/github'
|
||||
version: 5.0.3
|
||||
version: 5.1.1
|
||||
type: npm
|
||||
summary: Actions github lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||
|
||||
14
.licenses/npm/uuid.dep.yml
generated
14
.licenses/npm/uuid.dep.yml
generated
@@ -6,15 +6,15 @@ summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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 THE SOFTWARE.
|
||||
notices: []
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/add-to-project@RELEASE_VERSION
|
||||
with:
|
||||
# You can target a repository in a different organization
|
||||
# You can target a project in a different organization
|
||||
# to the issue
|
||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||
@@ -143,6 +143,12 @@ Using these events ensure that a given issue or pull request, in the workflow's
|
||||
- add the newly created PAT as a repository secret, this secret will be referenced by the [github-token input](#github-token)
|
||||
_See [Encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) for more information_
|
||||
|
||||
## Setting a specific status or column name to the project item
|
||||
|
||||
If you want to add an issue to a custom default column in a project (i.e. other than 'Todo'), you can do this directly via the project UI. You don't need to add anything else to your YAML workflow file to get this to work.
|
||||
|
||||
Use the [Add To GitHub Projects](https://github.com/marketplace/actions/add-to-github-projects) action to assign newly opened issues to the project. And then in the project UI simply [specify which column to use as the default](https://docs.github.com/en/issues/planning-and-tracking-with-projects/learning-about-projects/quickstart-for-projects#configure-built-in-automation)!
|
||||
|
||||
## Development
|
||||
|
||||
To get started contributing to this project, clone it and install dependencies.
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('addToProject', () => {
|
||||
beforeEach(() => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token'
|
||||
'github-token': 'gh_token',
|
||||
})
|
||||
|
||||
outputs = mockSetOutput()
|
||||
@@ -30,14 +30,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -46,21 +46,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -74,14 +74,14 @@ describe('addToProject', () => {
|
||||
number: 2221,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/octokit/octokit.js/issues/2221'
|
||||
html_url: 'https://github.com/octokit/octokit.js/issues/2221',
|
||||
},
|
||||
repository: {
|
||||
name: 'octokit.js',
|
||||
owner: {
|
||||
login: 'octokit'
|
||||
}
|
||||
}
|
||||
login: 'octokit',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -90,21 +90,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2DraftIssue/,
|
||||
return: {
|
||||
addProjectV2DraftIssue: {
|
||||
projectItem: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -116,7 +116,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new'
|
||||
labeled: 'bug, new',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -124,14 +124,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -140,21 +140,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -166,7 +166,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new'
|
||||
labeled: 'bug, new',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -175,14 +175,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/pull/136'
|
||||
html_url: 'https://github.com/actions/add-to-project/pull/136',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -191,21 +191,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -217,7 +217,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug'
|
||||
labeled: 'bug',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -225,14 +225,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
@@ -247,7 +247,7 @@ describe('addToProject', () => {
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
'label-operator': 'AND'
|
||||
'label-operator': 'AND',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -255,14 +255,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}, {name: 'new'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -271,21 +271,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -298,7 +298,7 @@ describe('addToProject', () => {
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
'label-operator': 'AND'
|
||||
'label-operator': 'AND',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -306,14 +306,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}, {name: 'other'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
@@ -328,7 +328,7 @@ describe('addToProject', () => {
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
'label-operator': 'NOT'
|
||||
'label-operator': 'NOT',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -336,14 +336,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
@@ -358,7 +358,7 @@ describe('addToProject', () => {
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
'label-operator': 'NOT'
|
||||
'label-operator': 'NOT',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -366,14 +366,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'other'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -382,21 +382,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-next-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-next-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-next-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-next-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -408,7 +408,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'accessibility,backend,bug'
|
||||
labeled: 'accessibility,backend,bug',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -416,14 +416,14 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'accessibility'}, {name: 'backend'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
@@ -432,21 +432,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
@@ -464,7 +464,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'accessibility, backend, bug'
|
||||
labeled: 'accessibility, backend, bug',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -472,21 +472,21 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [{name: 'data'}, {name: 'frontend'}, {name: 'improvement'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
const gqlMock = mockGraphQL()
|
||||
await addToProject()
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
`Skipping issue 1 because it does not have one of the labels: accessibility, backend, bug`
|
||||
`Skipping issue 1 because it does not have one of the labels: accessibility, backend, bug`,
|
||||
)
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
})
|
||||
@@ -495,7 +495,7 @@ describe('addToProject', () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'accessibility , backend ,, . , bug'
|
||||
labeled: 'accessibility , backend ,, . , bug',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -504,14 +504,14 @@ describe('addToProject', () => {
|
||||
labels: [{name: 'accessibility'}, {name: 'backend'}, {name: 'bug'}],
|
||||
'label-operator': 'AND',
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
@@ -520,21 +520,21 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
@@ -551,7 +551,7 @@ describe('addToProject', () => {
|
||||
test(`throws an error when url isn't a valid project url`, async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/github/repositories',
|
||||
'github-token': 'gh_token'
|
||||
'github-token': 'gh_token',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
@@ -559,182 +559,39 @@ describe('addToProject', () => {
|
||||
number: 1,
|
||||
labels: [],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
const gqlMock = mockGraphQL()
|
||||
await expect(addToProject()).rejects.toThrow(
|
||||
'https://github.com/orgs/github/repositories. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>'
|
||||
'Invalid project URL: https://github.com/orgs/github/repositories. Project URL should match the format <GitHub server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>',
|
||||
)
|
||||
expect(infoSpy).not.toHaveBeenCalled()
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test(`throws an error when url isn't under the github.com domain`, async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://notgithub.com/orgs/github/projects/1',
|
||||
'github-token': 'gh_token'
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
const gqlMock = mockGraphQL()
|
||||
await expect(addToProject()).rejects.toThrow(
|
||||
'https://notgithub.com/orgs/github/projects/1. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>'
|
||||
)
|
||||
expect(infoSpy).not.toHaveBeenCalled()
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
test('constructs the correct graphQL query given an organization owner', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new'
|
||||
})
|
||||
|
||||
test(`works with URLs that are not under the github.com domain`, async () => {
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
html_url: 'https://notgithub.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
{
|
||||
test: /getProject/,
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
|
||||
expect(gqlMock).toHaveBeenNthCalledWith(1, expect.stringContaining('organization(login: $projectOwnerName)'), {
|
||||
projectOwnerName: 'actions',
|
||||
projectNumber: 1
|
||||
})
|
||||
})
|
||||
|
||||
test('constructs the correct graphQL query given a user owner', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/users/monalisa/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new'
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/monalisa/add-to-project/issues/74'
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'monalisa'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
{
|
||||
test: /getProject/,
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
|
||||
expect(gqlMock).toHaveBeenNthCalledWith(1, expect.stringContaining('user(login: $projectOwnerName)'), {
|
||||
projectOwnerName: 'monalisa',
|
||||
projectNumber: 1
|
||||
})
|
||||
})
|
||||
|
||||
test('compares labels case-insensitively', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'FOO, Bar, baz',
|
||||
'label-operator': 'AND'
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'foo'}, {name: 'BAR'}, {name: 'baz'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74'
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
@@ -743,21 +600,178 @@ describe('addToProject', () => {
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-next-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-next-item-id'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
|
||||
expect(outputs.itemId).toEqual('project-item-id')
|
||||
})
|
||||
|
||||
test('constructs the correct graphQL query given an organization owner', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
{
|
||||
test: /getProject/,
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
|
||||
expect(gqlMock).toHaveBeenNthCalledWith(1, expect.stringContaining('organization(login: $projectOwnerName)'), {
|
||||
projectOwnerName: 'actions',
|
||||
projectNumber: 1,
|
||||
})
|
||||
})
|
||||
|
||||
test('constructs the correct graphQL query given a user owner', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/users/monalisa/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'bug, new',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'bug'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/monalisa/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'monalisa',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const gqlMock = mockGraphQL(
|
||||
{
|
||||
test: /getProject/,
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
|
||||
expect(gqlMock).toHaveBeenNthCalledWith(1, expect.stringContaining('user(login: $projectOwnerName)'), {
|
||||
projectOwnerName: 'monalisa',
|
||||
projectNumber: 1,
|
||||
})
|
||||
})
|
||||
|
||||
test('compares labels case-insensitively', async () => {
|
||||
mockGetInput({
|
||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||
'github-token': 'gh_token',
|
||||
labeled: 'FOO, Bar, baz',
|
||||
'label-operator': 'AND',
|
||||
})
|
||||
|
||||
github.context.payload = {
|
||||
issue: {
|
||||
number: 1,
|
||||
labels: [{name: 'foo'}, {name: 'BAR'}, {name: 'baz'}],
|
||||
// eslint-disable-next-line camelcase
|
||||
html_url: 'https://github.com/actions/add-to-project/issues/74',
|
||||
},
|
||||
repository: {
|
||||
name: 'add-to-project',
|
||||
owner: {
|
||||
login: 'actions',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
mockGraphQL(
|
||||
{
|
||||
test: /getProject/,
|
||||
return: {
|
||||
organization: {
|
||||
projectV2: {
|
||||
id: 'project-next-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /addProjectV2ItemById/,
|
||||
return: {
|
||||
addProjectV2ItemById: {
|
||||
item: {
|
||||
id: 'project-next-item-id',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
await addToProject()
|
||||
@@ -810,7 +824,7 @@ function mockGraphQL(...mocks: {test: RegExp; return: unknown}[]): jest.Mock {
|
||||
|
||||
jest.spyOn(github, 'getOctokit').mockImplementation(() => {
|
||||
return {
|
||||
graphql: mock
|
||||
graphql: mock,
|
||||
} as unknown as ReturnType<typeof github.getOctokit>
|
||||
})
|
||||
|
||||
|
||||
26
dist/index.js
generated
vendored
26
dist/index.js
generated
vendored
@@ -42,9 +42,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.mustGetOwnerTypeQuery = exports.addToProject = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
||||
const urlParse = /^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
||||
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
||||
function addToProject() {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@@ -61,6 +59,7 @@ function addToProject() {
|
||||
const issueLabels = ((_c = issue === null || issue === void 0 ? void 0 : issue.labels) !== null && _c !== void 0 ? _c : []).map((l) => l.name.toLowerCase());
|
||||
const issueOwnerName = (_d = github.context.payload.repository) === null || _d === void 0 ? void 0 : _d.owner.login;
|
||||
core.debug(`Issue/PR owner: ${issueOwnerName}`);
|
||||
core.debug(`Issue/PR labels: ${issueLabels.join(', ')}`);
|
||||
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||
if (labelOperator === 'and') {
|
||||
if (!labeled.every(l => issueLabels.includes(l))) {
|
||||
@@ -83,7 +82,7 @@ function addToProject() {
|
||||
core.debug(`Project URL: ${projectUrl}`);
|
||||
const urlMatch = projectUrl.match(urlParse);
|
||||
if (!urlMatch) {
|
||||
throw new Error(`Invalid project URL: ${projectUrl}. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>`);
|
||||
throw new Error(`Invalid project URL: ${projectUrl}. Project URL should match the format <GitHub server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>`);
|
||||
}
|
||||
const projectOwnerName = (_e = urlMatch.groups) === null || _e === void 0 ? void 0 : _e.ownerName;
|
||||
const projectNumber = parseInt((_g = (_f = urlMatch.groups) === null || _f === void 0 ? void 0 : _f.projectNumber) !== null && _g !== void 0 ? _g : '', 10);
|
||||
@@ -101,7 +100,7 @@ function addToProject() {
|
||||
}
|
||||
}`, {
|
||||
projectOwnerName,
|
||||
projectNumber
|
||||
projectNumber,
|
||||
});
|
||||
const projectId = (_j = idResp[ownerTypeQuery]) === null || _j === void 0 ? void 0 : _j.projectV2.id;
|
||||
const contentId = issue === null || issue === void 0 ? void 0 : issue.node_id;
|
||||
@@ -121,8 +120,8 @@ function addToProject() {
|
||||
}`, {
|
||||
input: {
|
||||
projectId,
|
||||
contentId
|
||||
}
|
||||
contentId,
|
||||
},
|
||||
});
|
||||
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id);
|
||||
}
|
||||
@@ -139,7 +138,7 @@ function addToProject() {
|
||||
}
|
||||
}`, {
|
||||
projectId,
|
||||
title: issue === null || issue === void 0 ? void 0 : issue.html_url
|
||||
title: issue === null || issue === void 0 ? void 0 : issue.html_url,
|
||||
});
|
||||
core.setOutput('itemId', addResp.addProjectV2DraftIssue.projectItem.id);
|
||||
}
|
||||
@@ -1290,8 +1289,9 @@ exports.context = new Context.Context();
|
||||
* @param token the repo PAT or GITHUB_TOKEN
|
||||
* @param options other options to set
|
||||
*/
|
||||
function getOctokit(token, options) {
|
||||
return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));
|
||||
function getOctokit(token, options, ...additionalPlugins) {
|
||||
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
|
||||
return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options));
|
||||
}
|
||||
exports.getOctokit = getOctokit;
|
||||
//# sourceMappingURL=github.js.map
|
||||
@@ -1373,7 +1373,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getOctokitOptions = exports.GitHub = exports.context = void 0;
|
||||
exports.getOctokitOptions = exports.GitHub = exports.defaults = exports.context = void 0;
|
||||
const Context = __importStar(__nccwpck_require__(4087));
|
||||
const Utils = __importStar(__nccwpck_require__(7914));
|
||||
// octokit + plugins
|
||||
@@ -1382,13 +1382,13 @@ const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044);
|
||||
const plugin_paginate_rest_1 = __nccwpck_require__(4193);
|
||||
exports.context = new Context.Context();
|
||||
const baseUrl = Utils.getApiBaseUrl();
|
||||
const defaults = {
|
||||
exports.defaults = {
|
||||
baseUrl,
|
||||
request: {
|
||||
agent: Utils.getProxyAgent(baseUrl)
|
||||
}
|
||||
};
|
||||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(defaults);
|
||||
exports.GitHub = core_1.Octokit.plugin(plugin_rest_endpoint_methods_1.restEndpointMethods, plugin_paginate_rest_1.paginateRest).defaults(exports.defaults);
|
||||
/**
|
||||
* Convience function to correctly format Octokit Options to pass into the constructor.
|
||||
*
|
||||
|
||||
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
@@ -3,7 +3,7 @@ module.exports = {
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testMatch: ['**/*.test.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
verbose: true
|
||||
verbose: true,
|
||||
}
|
||||
|
||||
1612
package-lock.json
generated
1612
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
@@ -5,27 +5,27 @@
|
||||
"author": "GitHub and contributors",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/github": "^5.0.3"
|
||||
"@actions/github": "^5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0",
|
||||
"npm": ">= 7.0.0"
|
||||
"node": ">=16.0.0 <20.0.0",
|
||||
"npm": ">= 8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@github/prettier-config": "^0.0.4",
|
||||
"@github/prettier-config": "^0.0.6",
|
||||
"@types/jest": "^27.5.0",
|
||||
"@types/node": "~16.18.3",
|
||||
"@typescript-eslint/parser": "^5.42.0",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"concurrently": "^7.5.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-plugin-github": "^4.4.0",
|
||||
"eslint-plugin-jest": "^27.1.3",
|
||||
"@types/node": "~16.18.23",
|
||||
"@typescript-eslint/parser": "^5.57.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"concurrently": "^8.0.1",
|
||||
"eslint": "^8.37.0",
|
||||
"eslint-plugin-github": "^4.7.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "2.7.1",
|
||||
"prettier": "2.8.7",
|
||||
"ts-jest": "^27.1.4",
|
||||
"typescript": "^4.8.4"
|
||||
"typescript": "^4.9.5"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
|
||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
||||
const urlParse =
|
||||
/^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||
|
||||
interface ProjectNodeIDResponse {
|
||||
organization?: {
|
||||
@@ -54,6 +51,7 @@ export async function addToProject(): Promise<void> {
|
||||
const issueOwnerName = github.context.payload.repository?.owner.login
|
||||
|
||||
core.debug(`Issue/PR owner: ${issueOwnerName}`)
|
||||
core.debug(`Issue/PR labels: ${issueLabels.join(', ')}`)
|
||||
|
||||
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||
if (labelOperator === 'and') {
|
||||
@@ -79,7 +77,7 @@ export async function addToProject(): Promise<void> {
|
||||
|
||||
if (!urlMatch) {
|
||||
throw new Error(
|
||||
`Invalid project URL: ${projectUrl}. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>`
|
||||
`Invalid project URL: ${projectUrl}. Project URL should match the format <GitHub server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>`,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -103,8 +101,8 @@ export async function addToProject(): Promise<void> {
|
||||
}`,
|
||||
{
|
||||
projectOwnerName,
|
||||
projectNumber
|
||||
}
|
||||
projectNumber,
|
||||
},
|
||||
)
|
||||
|
||||
const projectId = idResp[ownerTypeQuery]?.projectV2.id
|
||||
@@ -130,9 +128,9 @@ export async function addToProject(): Promise<void> {
|
||||
{
|
||||
input: {
|
||||
projectId,
|
||||
contentId
|
||||
}
|
||||
}
|
||||
contentId,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id)
|
||||
@@ -152,8 +150,8 @@ export async function addToProject(): Promise<void> {
|
||||
}`,
|
||||
{
|
||||
projectId,
|
||||
title: issue?.html_url
|
||||
}
|
||||
title: issue?.html_url,
|
||||
},
|
||||
)
|
||||
|
||||
core.setOutput('itemId', addResp.addProjectV2DraftIssue.projectItem.id)
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
||||
"noUncheckedIndexedAccess": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user