mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-11 20:47:05 +00:00
Compare commits
291 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0609a2702e | ||
|
|
9431bea31b | ||
|
|
0008229a22 | ||
|
|
5a5c08a0d8 | ||
|
|
0be3b6580a | ||
|
|
9c5d7e2309 | ||
|
|
6460bf625c | ||
|
|
c48fdd4a10 | ||
|
|
b953640a26 | ||
|
|
f9db65bca7 | ||
|
|
14158fbdd3 | ||
|
|
2271bbc40a | ||
|
|
4ae637c179 | ||
|
|
aff20dd010 | ||
|
|
a6f5f3bc15 | ||
|
|
af8bceb810 | ||
|
|
110be9cca7 | ||
|
|
1af3c586cc | ||
|
|
038cf47bad | ||
|
|
d8e41a4186 | ||
|
|
bff6ddc159 | ||
|
|
b06b35e111 | ||
|
|
9834efb291 | ||
|
|
3911b2e9c5 | ||
|
|
373aaa0026 | ||
|
|
646a190b35 | ||
|
|
31008e43a9 | ||
|
|
eeb6fcf287 | ||
|
|
c7360a863c | ||
|
|
2f1ef6a01a | ||
|
|
14e1b9faa9 | ||
|
|
bd71b387a0 | ||
|
|
30289aea8f | ||
|
|
63f3d754e5 | ||
|
|
5b82d0d8ea | ||
|
|
4f0b69f582 | ||
|
|
b4aa1e2987 | ||
|
|
dea980a46e | ||
|
|
e4eda1d50b | ||
|
|
fdad17b461 | ||
|
|
994ca9f75a | ||
|
|
7e57443d00 | ||
|
|
263cbdcb88 | ||
|
|
b2735aa0f6 | ||
|
|
8b31f68c82 | ||
|
|
2ffcee3a64 | ||
|
|
eb5b61b808 | ||
|
|
10a1247ab9 | ||
|
|
68a6e37819 | ||
|
|
14eeb7efcc | ||
|
|
f611246f06 | ||
|
|
f5fdff90c0 | ||
|
|
53c462ebe8 | ||
|
|
35f3b369a1 | ||
|
|
ac28c3eb83 | ||
|
|
89df6ee4c1 | ||
|
|
42a6ef18a1 | ||
|
|
ea9df88106 | ||
|
|
4ecc7c0b2b | ||
|
|
2b9d2149be | ||
|
|
750f734dd2 | ||
|
|
99cf218612 | ||
|
|
1dede3e656 | ||
|
|
39c65d18e0 | ||
|
|
103f97433b | ||
|
|
d64619acb0 | ||
|
|
1d9eb98615 | ||
|
|
93076d3c0e | ||
|
|
df2c84943f | ||
|
|
5fbfddbd6f | ||
|
|
1d9718fede | ||
|
|
d86bbfb918 | ||
|
|
59b84e0580 | ||
|
|
a79cf166b5 | ||
|
|
8a1828e332 | ||
|
|
973ebb68ca | ||
|
|
52557c7129 | ||
|
|
bdb4bf2fcf | ||
|
|
9b7cbef279 | ||
|
|
6d52a5575b | ||
|
|
54cc505d2c | ||
|
|
36f39f8b12 | ||
|
|
887f9e6239 | ||
|
|
7cb6768069 | ||
|
|
960ca110e0 | ||
|
|
edc057aef9 | ||
|
|
217b3883b1 | ||
|
|
0a99102a65 | ||
|
|
f755ecb9b8 | ||
|
|
44f5a43267 | ||
|
|
9c804266b5 | ||
|
|
36f5795260 | ||
|
|
94a6d20e97 | ||
|
|
87ad3e8048 | ||
|
|
1c24cd01de | ||
|
|
5fd82c5072 | ||
|
|
002af53ca7 | ||
|
|
a800ee6382 | ||
|
|
96579b343d | ||
|
|
cab3e8fdaa | ||
|
|
55c5983362 | ||
|
|
0da8e46333 | ||
|
|
8390e920ed | ||
|
|
338542c930 | ||
|
|
f85c23163a | ||
|
|
cadd99bebf | ||
|
|
36ac48f374 | ||
|
|
89ec196c28 | ||
|
|
2b4e8a9194 | ||
|
|
c04c801147 | ||
|
|
d9c2169b6f | ||
|
|
66892474a2 | ||
|
|
faf4a19111 | ||
|
|
65dd57f6b0 | ||
|
|
049d72e93d | ||
|
|
f38f906848 | ||
|
|
a0cf74c4d7 | ||
|
|
8d46d9f2ac | ||
|
|
773b37dca5 | ||
|
|
4168cdeca9 | ||
|
|
99573159d7 | ||
|
|
e5b05071cb | ||
|
|
78adc2f97c | ||
|
|
5ba1147d0e | ||
|
|
9091986763 | ||
|
|
701d4fe4b8 | ||
|
|
ecd6bc5aa6 | ||
|
|
588a05eb5b | ||
|
|
2aacd207b9 | ||
|
|
1b04211a9f | ||
|
|
a0b6033202 | ||
|
|
f8b212372d | ||
|
|
23400f5f47 | ||
|
|
c3dbb76ad4 | ||
|
|
af1fa79daa | ||
|
|
e55c147417 | ||
|
|
2cd206c9cf | ||
|
|
f52c62c27e | ||
|
|
023bb5edd4 | ||
|
|
8ddc3f9980 | ||
|
|
67c82de2ee | ||
|
|
ce05fa3d42 | ||
|
|
c09eea1d38 | ||
|
|
bde621f03e | ||
|
|
7c06a2e8a7 | ||
|
|
23e1389971 | ||
|
|
7c31fa90d2 | ||
|
|
87685c7bcb | ||
|
|
ad77019bd2 | ||
|
|
25f81e7584 | ||
|
|
64a95f9963 | ||
|
|
0a7abacdd4 | ||
|
|
6319fbf4ab | ||
|
|
16678f07cc | ||
|
|
deca6c76d5 | ||
|
|
436b60e3c7 | ||
|
|
c38ba3918b | ||
|
|
539b3f97fd | ||
|
|
2eedc0bd12 | ||
|
|
9d30cd4ea3 | ||
|
|
80dff83603 | ||
|
|
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 |
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
@@ -20,12 +20,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set Node.js 12.x
|
- name: Set Node.js 20.x
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 20.x
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|||||||
2
.github/workflows/licensed.yml
vendored
2
.github/workflows/licensed.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Check licenses
|
name: Check licenses
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Install licensed
|
- name: Install licensed
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
build: # make sure build/ci work properly
|
build: # make sure build/ci work properly
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: |
|
- run: |
|
||||||
npm install
|
npm install
|
||||||
- run: |
|
- run: |
|
||||||
|
|||||||
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
|
version: 1.10.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)
|
||||||
|
|
||||||
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: []
|
notices: []
|
||||||
|
|||||||
2
.licenses/npm/@actions/github.dep.yml
generated
2
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: '@actions/github'
|
name: '@actions/github'
|
||||||
version: 5.0.3
|
version: 5.1.1
|
||||||
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
|
||||||
|
|||||||
16
.licenses/npm/uuid.dep.yml
generated
16
.licenses/npm/uuid.dep.yml
generated
@@ -3,18 +3,18 @@ name: uuid
|
|||||||
version: 8.3.2
|
version: 8.3.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
summary: RFC4122 (v1, v4, and v5) UUIDs
|
||||||
homepage:
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |
|
text: |
|
||||||
The MIT License (MIT)
|
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: []
|
notices: []
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -38,7 +38,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@RELEASE_VERSION
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
with:
|
with:
|
||||||
# You can target a repository in a different organization
|
# You can target a project in a different organization
|
||||||
# to the issue
|
# to the issue
|
||||||
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 }}
|
||||||
@@ -81,7 +81,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add-to-project:
|
add-to-project:
|
||||||
name: Add issue to project
|
name: Add pull request to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/add-to-project@RELEASE_VERSION
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
@@ -124,12 +124,14 @@ jobs:
|
|||||||
Currently this action supports the following [`issues` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues):
|
Currently this action supports the following [`issues` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues):
|
||||||
|
|
||||||
- `opened`
|
- `opened`
|
||||||
|
- `reopened`
|
||||||
- `transferred`
|
- `transferred`
|
||||||
- `labeled`
|
- `labeled`
|
||||||
|
|
||||||
and the following [`pull_request` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request):
|
and the following [`pull_request` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request):
|
||||||
|
|
||||||
- `opened`
|
- `opened`
|
||||||
|
- `reopened`
|
||||||
- `labeled`
|
- `labeled`
|
||||||
|
|
||||||
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.
|
||||||
@@ -137,12 +139,20 @@ Using these events ensure that a given issue or pull request, in the workflow's
|
|||||||
## 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` and `project` scopes
|
token](https://github.com/settings/tokens/new) with `project` scope. For private repos you will also need `repo` scope.
|
||||||
_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_
|
||||||
|
|
||||||
|
> **NOTE:** ℹ️ Use a classic token with full control of projects. Personal access tokens with fine grained access do not support the GraphQL API.
|
||||||
|
|
||||||
- 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)
|
||||||
_See [Encrypted secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) for more information_
|
_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
|
## Development
|
||||||
|
|
||||||
To get started contributing to this project, clone it and install dependencies.
|
To get started contributing to this project, clone it and install dependencies.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ describe('addToProject', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token'
|
'github-token': 'gh_token',
|
||||||
})
|
})
|
||||||
|
|
||||||
outputs = mockSetOutput()
|
outputs = mockSetOutput()
|
||||||
@@ -30,14 +30,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -46,21 +46,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -74,14 +74,14 @@ describe('addToProject', () => {
|
|||||||
number: 2221,
|
number: 2221,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'octokit.js',
|
name: 'octokit.js',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'octokit'
|
login: 'octokit',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -90,21 +90,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2DraftIssue/,
|
test: /addProjectV2DraftIssue/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2DraftIssue: {
|
addProjectV2DraftIssue: {
|
||||||
projectItem: {
|
projectItem: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -116,7 +116,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new'
|
labeled: 'bug, new',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -124,14 +124,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -140,21 +140,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -166,7 +166,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new'
|
labeled: 'bug, new',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -175,14 +175,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -191,21 +191,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -217,7 +217,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug'
|
labeled: 'bug',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -225,14 +225,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [],
|
labels: [],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
@@ -247,7 +247,7 @@ describe('addToProject', () => {
|
|||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new',
|
labeled: 'bug, new',
|
||||||
'label-operator': 'AND'
|
'label-operator': 'AND',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -255,14 +255,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}, {name: 'new'}],
|
labels: [{name: 'bug'}, {name: 'new'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -271,21 +271,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -298,7 +298,7 @@ describe('addToProject', () => {
|
|||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new',
|
labeled: 'bug, new',
|
||||||
'label-operator': 'AND'
|
'label-operator': 'AND',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -306,14 +306,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}, {name: 'other'}],
|
labels: [{name: 'bug'}, {name: 'other'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
@@ -328,7 +328,7 @@ describe('addToProject', () => {
|
|||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new',
|
labeled: 'bug, new',
|
||||||
'label-operator': 'NOT'
|
'label-operator': 'NOT',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -336,14 +336,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
@@ -358,7 +358,7 @@ describe('addToProject', () => {
|
|||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug, new',
|
labeled: 'bug, new',
|
||||||
'label-operator': 'NOT'
|
'label-operator': 'NOT',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -366,14 +366,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'other'}],
|
labels: [{name: 'other'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
mockGraphQL(
|
mockGraphQL(
|
||||||
@@ -382,21 +382,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-next-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-next-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
@@ -408,7 +408,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'accessibility,backend,bug'
|
labeled: 'accessibility,backend,bug',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -416,14 +416,14 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'accessibility'}, {name: 'backend'}],
|
labels: [{name: 'accessibility'}, {name: 'backend'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const gqlMock = mockGraphQL(
|
const gqlMock = mockGraphQL(
|
||||||
@@ -432,21 +432,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
@@ -464,7 +464,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'accessibility, backend, bug'
|
labeled: 'accessibility, backend, bug',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -472,21 +472,21 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'data'}, {name: 'frontend'}, {name: 'improvement'}],
|
labels: [{name: 'data'}, {name: 'frontend'}, {name: 'improvement'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
const gqlMock = mockGraphQL()
|
const gqlMock = mockGraphQL()
|
||||||
await addToProject()
|
await addToProject()
|
||||||
expect(infoSpy).toHaveBeenCalledWith(
|
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()
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
@@ -495,7 +495,7 @@ describe('addToProject', () => {
|
|||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/actions/projects/1',
|
'project-url': 'https://github.com/orgs/actions/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'accessibility , backend ,, . , bug'
|
labeled: 'accessibility , backend ,, . , bug',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -504,14 +504,14 @@ describe('addToProject', () => {
|
|||||||
labels: [{name: 'accessibility'}, {name: 'backend'}, {name: 'bug'}],
|
labels: [{name: 'accessibility'}, {name: 'backend'}, {name: 'bug'}],
|
||||||
'label-operator': 'AND',
|
'label-operator': 'AND',
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const gqlMock = mockGraphQL(
|
const gqlMock = mockGraphQL(
|
||||||
@@ -520,21 +520,21 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
item: {
|
||||||
id: 'project-item-id'
|
id: 'project-item-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
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 () => {
|
test(`throws an error when url isn't a valid project url`, async () => {
|
||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/github/repositories',
|
'project-url': 'https://github.com/orgs/github/repositories',
|
||||||
'github-token': 'gh_token'
|
'github-token': 'gh_token',
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -559,182 +559,39 @@ describe('addToProject', () => {
|
|||||||
number: 1,
|
number: 1,
|
||||||
labels: [],
|
labels: [],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
login: 'actions',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const infoSpy = jest.spyOn(core, 'info')
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
const gqlMock = mockGraphQL()
|
const gqlMock = mockGraphQL()
|
||||||
await expect(addToProject()).rejects.toThrow(
|
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(infoSpy).not.toHaveBeenCalled()
|
||||||
expect(gqlMock).not.toHaveBeenCalled()
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
test(`throws an error when url isn't under the github.com domain`, async () => {
|
test(`works with URLs that are not 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'
|
|
||||||
})
|
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
issue: {
|
issue: {
|
||||||
number: 1,
|
number: 1,
|
||||||
labels: [{name: 'bug'}],
|
labels: [{name: 'bug'}],
|
||||||
// eslint-disable-next-line camelcase
|
// 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: {
|
repository: {
|
||||||
name: 'add-to-project',
|
name: 'add-to-project',
|
||||||
owner: {
|
owner: {
|
||||||
login: 'actions'
|
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(
|
mockGraphQL(
|
||||||
@@ -743,21 +600,178 @@ describe('addToProject', () => {
|
|||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectV2: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectV2ItemById/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectV2ItemById: {
|
addProjectV2ItemById: {
|
||||||
item: {
|
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()
|
await addToProject()
|
||||||
@@ -810,7 +824,7 @@ function mockGraphQL(...mocks: {test: RegExp; return: unknown}[]): jest.Mock {
|
|||||||
|
|
||||||
jest.spyOn(github, 'getOctokit').mockImplementation(() => {
|
jest.spyOn(github, 'getOctokit').mockImplementation(() => {
|
||||||
return {
|
return {
|
||||||
graphql: mock
|
graphql: mock,
|
||||||
} as unknown as ReturnType<typeof github.getOctokit>
|
} as unknown as ReturnType<typeof github.getOctokit>
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ description: Automatically add issues and PRs to GitHub projects
|
|||||||
author: GitHub
|
author: GitHub
|
||||||
branding:
|
branding:
|
||||||
icon: table
|
icon: table
|
||||||
|
color: white
|
||||||
inputs:
|
inputs:
|
||||||
project-url:
|
project-url:
|
||||||
required: true
|
required: true
|
||||||
@@ -16,6 +17,9 @@ inputs:
|
|||||||
label-operator:
|
label-operator:
|
||||||
required: false
|
required: false
|
||||||
description: The behavior of the labels filter, AND to match all labels, OR to match any label, NOT to exclude any listed label (default is OR)
|
description: The behavior of the labels filter, AND to match all labels, OR to match any label, NOT to exclude any listed label (default is OR)
|
||||||
|
outputs:
|
||||||
|
itemId:
|
||||||
|
description: The ID of the item that was added to the project
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
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;
|
exports.mustGetOwnerTypeQuery = exports.addToProject = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
||||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
|
||||||
const urlParse = /^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
|
||||||
function addToProject() {
|
function addToProject() {
|
||||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
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 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;
|
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 owner: ${issueOwnerName}`);
|
||||||
|
core.debug(`Issue/PR labels: ${issueLabels.join(', ')}`);
|
||||||
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||||
if (labelOperator === 'and') {
|
if (labelOperator === 'and') {
|
||||||
if (!labeled.every(l => issueLabels.includes(l))) {
|
if (!labeled.every(l => issueLabels.includes(l))) {
|
||||||
@@ -83,7 +82,7 @@ function addToProject() {
|
|||||||
core.debug(`Project URL: ${projectUrl}`);
|
core.debug(`Project URL: ${projectUrl}`);
|
||||||
const urlMatch = projectUrl.match(urlParse);
|
const urlMatch = projectUrl.match(urlParse);
|
||||||
if (!urlMatch) {
|
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 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);
|
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,
|
projectOwnerName,
|
||||||
projectNumber
|
projectNumber,
|
||||||
});
|
});
|
||||||
const projectId = (_j = idResp[ownerTypeQuery]) === null || _j === void 0 ? void 0 : _j.projectV2.id;
|
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;
|
const contentId = issue === null || issue === void 0 ? void 0 : issue.node_id;
|
||||||
@@ -121,8 +120,8 @@ function addToProject() {
|
|||||||
}`, {
|
}`, {
|
||||||
input: {
|
input: {
|
||||||
projectId,
|
projectId,
|
||||||
contentId
|
contentId,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id);
|
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id);
|
||||||
}
|
}
|
||||||
@@ -139,7 +138,7 @@ function addToProject() {
|
|||||||
}
|
}
|
||||||
}`, {
|
}`, {
|
||||||
projectId,
|
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);
|
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 token the repo PAT or GITHUB_TOKEN
|
||||||
* @param options other options to set
|
* @param options other options to set
|
||||||
*/
|
*/
|
||||||
function getOctokit(token, options) {
|
function getOctokit(token, options, ...additionalPlugins) {
|
||||||
return new utils_1.GitHub(utils_1.getOctokitOptions(token, options));
|
const GitHubWithPlugins = utils_1.GitHub.plugin(...additionalPlugins);
|
||||||
|
return new GitHubWithPlugins(utils_1.getOctokitOptions(token, options));
|
||||||
}
|
}
|
||||||
exports.getOctokit = getOctokit;
|
exports.getOctokit = getOctokit;
|
||||||
//# sourceMappingURL=github.js.map
|
//# sourceMappingURL=github.js.map
|
||||||
@@ -1373,7 +1373,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
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 Context = __importStar(__nccwpck_require__(4087));
|
||||||
const Utils = __importStar(__nccwpck_require__(7914));
|
const Utils = __importStar(__nccwpck_require__(7914));
|
||||||
// octokit + plugins
|
// octokit + plugins
|
||||||
@@ -1382,13 +1382,13 @@ const plugin_rest_endpoint_methods_1 = __nccwpck_require__(3044);
|
|||||||
const plugin_paginate_rest_1 = __nccwpck_require__(4193);
|
const plugin_paginate_rest_1 = __nccwpck_require__(4193);
|
||||||
exports.context = new Context.Context();
|
exports.context = new Context.Context();
|
||||||
const baseUrl = Utils.getApiBaseUrl();
|
const baseUrl = Utils.getApiBaseUrl();
|
||||||
const defaults = {
|
exports.defaults = {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
request: {
|
request: {
|
||||||
agent: Utils.getProxyAgent(baseUrl)
|
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.
|
* 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'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest',
|
||||||
},
|
},
|
||||||
verbose: true
|
verbose: true,
|
||||||
}
|
}
|
||||||
|
|||||||
7577
package-lock.json
generated
7577
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -5,27 +5,28 @@
|
|||||||
"author": "GitHub and contributors",
|
"author": "GitHub and contributors",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.0.3"
|
"@actions/github": "^5.1.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0 <17.0.0",
|
"node": ">=16.0.0",
|
||||||
"npm": ">= 7.0.0"
|
"npm": ">= 8.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@github/prettier-config": "^0.0.4",
|
"@github/prettier-config": "^0.0.6",
|
||||||
"@types/jest": "^27.5.0",
|
"@types/jest": "^29.5.7",
|
||||||
"@types/node": "~16.18.3",
|
"@types/node": "16.18.60",
|
||||||
"@typescript-eslint/parser": "^5.42.0",
|
"@typescript-eslint/parser": "^6.9.1",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||||
"concurrently": "^7.5.0",
|
"@vercel/ncc": "^0.38.0",
|
||||||
"eslint": "^8.26.0",
|
"concurrently": "^8.2.1",
|
||||||
"eslint-plugin-github": "^4.4.0",
|
"eslint": "^8.49.0",
|
||||||
"eslint-plugin-jest": "^27.1.3",
|
"eslint-plugin-github": "^4.10.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-jest": "^27.6.0",
|
||||||
"jest": "^27.5.1",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"prettier": "2.7.1",
|
"jest": "^29.7.0",
|
||||||
"ts-jest": "^27.1.4",
|
"prettier": "3.0.3",
|
||||||
"typescript": "^4.8.4"
|
"ts-jest": "^29.1.1",
|
||||||
|
"typescript": "^5.2.2"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
|
|
||||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
|
||||||
const urlParse =
|
|
||||||
/^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
|
||||||
|
|
||||||
interface ProjectNodeIDResponse {
|
interface ProjectNodeIDResponse {
|
||||||
organization?: {
|
organization?: {
|
||||||
@@ -54,6 +51,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
const issueOwnerName = github.context.payload.repository?.owner.login
|
const issueOwnerName = github.context.payload.repository?.owner.login
|
||||||
|
|
||||||
core.debug(`Issue/PR owner: ${issueOwnerName}`)
|
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.
|
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||||
if (labelOperator === 'and') {
|
if (labelOperator === 'and') {
|
||||||
@@ -79,7 +77,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
|
|
||||||
if (!urlMatch) {
|
if (!urlMatch) {
|
||||||
throw new Error(
|
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,
|
projectOwnerName,
|
||||||
projectNumber
|
projectNumber,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const projectId = idResp[ownerTypeQuery]?.projectV2.id
|
const projectId = idResp[ownerTypeQuery]?.projectV2.id
|
||||||
@@ -130,9 +128,9 @@ export async function addToProject(): Promise<void> {
|
|||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
projectId,
|
projectId,
|
||||||
contentId
|
contentId,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id)
|
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id)
|
||||||
@@ -152,8 +150,8 @@ export async function addToProject(): Promise<void> {
|
|||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
projectId,
|
projectId,
|
||||||
title: issue?.html_url
|
title: issue?.html_url,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
core.setOutput('itemId', addResp.addProjectV2DraftIssue.projectItem.id)
|
core.setOutput('itemId', addResp.addProjectV2DraftIssue.projectItem.id)
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
|
"target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
|
||||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
||||||
"outDir": "./lib" /* Redirect output structure to the directory. */,
|
"outDir": "./lib" /* Redirect output structure to the directory. */,
|
||||||
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
|
"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. */,
|
"strict": true /* Enable all strict type-checking options. */,
|
||||||
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
"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,
|
||||||
|
"lib": ["ES2015"]
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user