mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-11 20:47:05 +00:00
Compare commits
252 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0af0b18f28 | ||
|
|
c8dd399614 | ||
|
|
f111c2aa36 | ||
|
|
12e917e04c | ||
|
|
dbe00218fb | ||
|
|
fa0b958991 | ||
|
|
f343062b82 | ||
|
|
e639bba4f0 | ||
|
|
34ff2c7db4 | ||
|
|
4065956be9 | ||
|
|
9b0fd13e3f | ||
|
|
53d95574f4 | ||
|
|
31c3cce717 | ||
|
|
c1795be3bc | ||
|
|
75ae529d21 | ||
|
|
93eba4a2e5 | ||
|
|
5582d9894f | ||
|
|
97e01d66ef | ||
|
|
2a4deb3f9f | ||
|
|
458653506b | ||
|
|
322721b8cd | ||
|
|
601b150078 | ||
|
|
665443b5d9 | ||
|
|
caae605ffb | ||
|
|
5d3a082e24 | ||
|
|
80b198ce77 | ||
|
|
92eaaeabac | ||
|
|
8eedaeb3f8 | ||
|
|
3b83e6acf9 | ||
|
|
0bf2f64851 | ||
|
|
ce9d751c8c | ||
|
|
2b841e5b72 | ||
|
|
7ca6a73a54 | ||
|
|
79db2f4851 | ||
|
|
cf1add2ac3 | ||
|
|
50a0a4c60e | ||
|
|
ed9ec99956 | ||
|
|
79316c3c93 | ||
|
|
2914167b9b | ||
|
|
7334092ecc | ||
|
|
aeb80ee3ca | ||
|
|
a1e8057254 | ||
|
|
94b35fc3df | ||
|
|
188881c8fc | ||
|
|
555ebcb094 | ||
|
|
73cb31d05f | ||
|
|
88c4df44ff | ||
|
|
bbdd7d7680 | ||
|
|
6e2d6ef546 | ||
|
|
a412549585 | ||
|
|
fedaa03863 | ||
|
|
5152387edb | ||
|
|
10552f6f89 | ||
|
|
69f6549fe2 | ||
|
|
c05fcc9dfb | ||
|
|
a0fa063143 | ||
|
|
ff2392aa0d | ||
|
|
d0b7876408 | ||
|
|
0f1ba59d26 | ||
|
|
67c5a7e0a1 | ||
|
|
965058f5bb | ||
|
|
bbc19edc9d | ||
|
|
f7823161aa | ||
|
|
fcb780e2b5 | ||
|
|
58aca2b7ff | ||
|
|
001e0b58eb | ||
|
|
04a1f56d53 | ||
|
|
e0b64e7b67 | ||
|
|
c1a80e93ea | ||
|
|
be967da52c | ||
|
|
f6a381cfe2 | ||
|
|
9a2b32ee11 | ||
|
|
d8749d7229 | ||
|
|
9484e7ea49 | ||
|
|
4453a5e17d | ||
|
|
bad07b756f | ||
|
|
c4d924563d | ||
|
|
339ee3c166 | ||
|
|
da77ec5a48 | ||
|
|
eaf932c4b2 | ||
|
|
47772ca04a | ||
|
|
bd184e5d13 | ||
|
|
a07cbd5d20 | ||
|
|
395b51773c | ||
|
|
7a40b30747 | ||
|
|
c7c6f60f14 | ||
|
|
53101abf47 | ||
|
|
0c1e36ed75 | ||
|
|
8d66869b6c | ||
|
|
3815017653 | ||
|
|
38d93b7ff2 | ||
|
|
544ce1ff15 | ||
|
|
f993b92dab | ||
|
|
b56023be57 | ||
|
|
e9fda8a6a9 | ||
|
|
63ec0f9def | ||
|
|
031135e10e | ||
|
|
138f841d13 | ||
|
|
fdbee5d018 | ||
|
|
75cfc23c1b | ||
|
|
1b4f9e5215 | ||
|
|
1664cea4b1 | ||
|
|
58dc7efeb3 | ||
|
|
8bc56cd807 | ||
|
|
8e43a9d0d7 | ||
|
|
4cf3abb9ff | ||
|
|
2d863964e7 | ||
|
|
95da4c39c2 | ||
|
|
80de5b79f3 | ||
|
|
7d736a78c2 | ||
|
|
66112f7fe4 | ||
|
|
6125b7b6b6 | ||
|
|
c92f1c7b9c | ||
|
|
dbee858226 | ||
|
|
257e8e8fed | ||
|
|
92bff04cc1 | ||
|
|
5bb8b529cc | ||
|
|
fea7d52087 | ||
|
|
3b2ebb081c | ||
|
|
29eb7cef84 | ||
|
|
98def91cef | ||
|
|
8f59162ff6 | ||
|
|
9ac721fd8a | ||
|
|
c91186afaf | ||
|
|
3547ee9c81 | ||
|
|
f1c55a1027 | ||
|
|
7c18796dcd | ||
|
|
0bb745994b | ||
|
|
8a004791b5 | ||
|
|
a02a2e0e2e | ||
|
|
9473fe1ada | ||
|
|
c5b334e234 | ||
|
|
71ccec7e4d | ||
|
|
f9b1fc05c3 | ||
|
|
cf477c15a9 | ||
|
|
a5a8e154d8 | ||
|
|
6e2fa5f9f3 | ||
|
|
4205d79489 | ||
|
|
f08a2688cd | ||
|
|
24160a1bc2 | ||
|
|
0137df9c8d | ||
|
|
30f559df98 | ||
|
|
dc41eefd3f | ||
|
|
661f5254e8 | ||
|
|
2a2f1e9ba9 | ||
|
|
d0ecdf4a86 | ||
|
|
03a446013c | ||
|
|
b01f724082 | ||
|
|
f27c638b90 | ||
|
|
6fcbe1004c | ||
|
|
399d8e0210 | ||
|
|
bd2c6a9d39 | ||
|
|
7812e58042 | ||
|
|
0780acfc24 | ||
|
|
749c4ae123 | ||
|
|
33053c60fb | ||
|
|
d028344d28 | ||
|
|
b899acf143 | ||
|
|
5a6232de3d | ||
|
|
f50c5f7f33 | ||
|
|
5f2fb781f1 | ||
|
|
5a36c405bf | ||
|
|
7b62e2081a | ||
|
|
698949779b | ||
|
|
012e2b444d | ||
|
|
96b0e568a8 | ||
|
|
765e16bbaa | ||
|
|
e619ea2c48 | ||
|
|
196691e90c | ||
|
|
7a0820f976 | ||
|
|
740e8854f3 | ||
|
|
9baf5dabd0 | ||
|
|
d613567480 | ||
|
|
37c8e849d6 | ||
|
|
d07f6a07cd | ||
|
|
fb013c35f1 | ||
|
|
1b03f3603c | ||
|
|
642595b881 | ||
|
|
91547225cb | ||
|
|
cc13eb1eed | ||
|
|
859e9c6de8 | ||
|
|
a064fc6c14 | ||
|
|
747607c26a | ||
|
|
e792050be0 | ||
|
|
5a4b423126 | ||
|
|
2d99f6893d | ||
|
|
74723b6181 | ||
|
|
7279692a52 | ||
|
|
ff5cbc4a18 | ||
|
|
ddb85f88a6 | ||
|
|
389b584dba | ||
|
|
8ff4c87a86 | ||
|
|
6d9d871643 | ||
|
|
904617435f | ||
|
|
430f56e93a | ||
|
|
bd59204a4e | ||
|
|
dbf2554d4e | ||
|
|
9d1641a3bd | ||
|
|
5299f80a50 | ||
|
|
ee68bb0c2b | ||
|
|
b35ff12cb8 | ||
|
|
630f81ad40 | ||
|
|
9b4ee3afe6 | ||
|
|
c34a4ba357 | ||
|
|
b1476f2e9c | ||
|
|
bc78a1e115 | ||
|
|
3027b57d3a | ||
|
|
30f4425d9f | ||
|
|
befcba3a7b | ||
|
|
f4bd1b98a2 | ||
|
|
cea962d65d | ||
|
|
ab6db1a88c | ||
|
|
4fdd6b24ca | ||
|
|
e5b605042a | ||
|
|
a6c2fe7584 | ||
|
|
651feff179 | ||
|
|
1b019a7e9a | ||
|
|
fd3d381359 | ||
|
|
2c0269fb8f | ||
|
|
83ac05270f | ||
|
|
6830646051 | ||
|
|
547a40daf6 | ||
|
|
6d98dac883 | ||
|
|
23de7216be | ||
|
|
c669f5c5a0 | ||
|
|
ffbcbbc91f | ||
|
|
03acc14e46 | ||
|
|
f98f7a758c | ||
|
|
b1a76b9854 | ||
|
|
959b0d462b | ||
|
|
a113ff8a4a | ||
|
|
752ba69790 | ||
|
|
069f327762 | ||
|
|
106684e914 | ||
|
|
4887ffd3e0 | ||
|
|
d3bdc22ebd | ||
|
|
aa09aa5940 | ||
|
|
4a5df49dfe | ||
|
|
4d561a46b3 | ||
|
|
d8cf04bb66 | ||
|
|
d9b0535d09 | ||
|
|
19cb14e026 | ||
|
|
c6f7b220db | ||
|
|
3cc9b29b07 | ||
|
|
3e3f8b5f8f | ||
|
|
8e16a73f49 | ||
|
|
dc9f7ee311 | ||
|
|
0ad701a62e | ||
|
|
beea8e26fe | ||
|
|
4ed7975d8d | ||
|
|
edbc4f0322 | ||
|
|
85757d613c |
6
.github/workflows/check-dist.yml
vendored
6
.github/workflows/check-dist.yml
vendored
@@ -20,10 +20,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 12.x
|
- name: Set Node.js 12.x
|
||||||
uses: actions/setup-node@v2.5.1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
cache: npm
|
cache: npm
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
|||||||
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: 'CodeQL'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [main]
|
||||||
|
schedule:
|
||||||
|
- cron: '18 2 * * 2'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: ['javascript']
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -13,8 +13,10 @@ 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@v2
|
- uses: actions/checkout@v3
|
||||||
- run: |
|
- run: |
|
||||||
npm install
|
npm install
|
||||||
- run: |
|
- run: |
|
||||||
npm run build
|
npm run build
|
||||||
|
- run: |
|
||||||
|
npm run test
|
||||||
|
|||||||
4
.licenses/npm/@actions/core.dep.yml
generated
4
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/core"
|
name: '@actions/core'
|
||||||
version: 1.6.0
|
version: 1.9.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions core lib
|
summary: Actions core lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
|||||||
4
.licenses/npm/@actions/github.dep.yml
generated
4
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/github"
|
name: '@actions/github'
|
||||||
version: 5.0.0
|
version: 5.0.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions github lib
|
summary: Actions github lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||||
|
|||||||
6
.licenses/npm/@actions/http-client.dep.yml
generated
6
.licenses/npm/@actions/http-client.dep.yml
generated
@@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/http-client"
|
name: '@actions/http-client'
|
||||||
version: 1.0.11
|
version: 2.0.1
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions Http Client
|
summary: Actions Http Client
|
||||||
homepage: https://github.com/actions/http-client#readme
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
4
.licenses/npm/@octokit/auth-token.dep.yml
generated
4
.licenses/npm/@octokit/auth-token.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/auth-token"
|
name: '@octokit/auth-token'
|
||||||
version: 2.5.0
|
version: 2.5.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: GitHub API token authentication for browsers and Node.js
|
summary: GitHub API token authentication for browsers and Node.js
|
||||||
@@ -30,5 +30,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
6
.licenses/npm/@octokit/core.dep.yml
generated
6
.licenses/npm/@octokit/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/core"
|
name: '@octokit/core'
|
||||||
version: 3.5.1
|
version: 3.6.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||||
homepage:
|
homepage:
|
||||||
@@ -30,5 +30,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/endpoint.dep.yml
generated
4
.licenses/npm/@octokit/endpoint.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/endpoint"
|
name: '@octokit/endpoint'
|
||||||
version: 6.0.12
|
version: 6.0.12
|
||||||
type: npm
|
type: npm
|
||||||
summary: Turns REST API endpoints into generic request options
|
summary: Turns REST API endpoints into generic request options
|
||||||
@@ -30,5 +30,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/graphql.dep.yml
generated
4
.licenses/npm/@octokit/graphql.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/graphql"
|
name: '@octokit/graphql'
|
||||||
version: 4.8.0
|
version: 4.8.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: GitHub GraphQL API client for browsers and Node
|
summary: GitHub GraphQL API client for browsers and Node
|
||||||
@@ -30,5 +30,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/openapi-types.dep.yml
generated
4
.licenses/npm/@octokit/openapi-types.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/openapi-types"
|
name: '@octokit/openapi-types'
|
||||||
version: 11.2.0
|
version: 11.2.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com
|
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com
|
||||||
@@ -16,5 +16,5 @@ licenses:
|
|||||||
|
|
||||||
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.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/plugin-paginate-rest"
|
name: '@octokit/plugin-paginate-rest'
|
||||||
version: 2.17.0
|
version: 2.17.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Octokit plugin to paginate REST API endpoint responses
|
summary: Octokit plugin to paginate REST API endpoint responses
|
||||||
@@ -16,5 +16,5 @@ licenses:
|
|||||||
|
|
||||||
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.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/plugin-rest-endpoint-methods"
|
name: '@octokit/plugin-rest-endpoint-methods'
|
||||||
version: 5.13.0
|
version: 5.13.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||||
@@ -16,5 +16,5 @@ licenses:
|
|||||||
|
|
||||||
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.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/request-error.dep.yml
generated
4
.licenses/npm/@octokit/request-error.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/request-error"
|
name: '@octokit/request-error'
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Error class for Octokit request errors
|
summary: Error class for Octokit request errors
|
||||||
@@ -30,5 +30,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/request.dep.yml
generated
4
.licenses/npm/@octokit/request.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/request"
|
name: '@octokit/request'
|
||||||
version: 5.6.3
|
version: 5.6.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Send parameterized requests to GitHub's APIs with sensible defaults in browsers
|
summary: Send parameterized requests to GitHub's APIs with sensible defaults in browsers
|
||||||
@@ -31,5 +31,5 @@ licenses:
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
4
.licenses/npm/@octokit/types.dep.yml
generated
4
.licenses/npm/@octokit/types.dep.yml
generated
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/types"
|
name: '@octokit/types'
|
||||||
version: 6.34.0
|
version: 6.34.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Shared TypeScript definitions for Octokit projects
|
summary: Shared TypeScript definitions for Octokit projects
|
||||||
@@ -16,5 +16,5 @@ licenses:
|
|||||||
|
|
||||||
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.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[MIT](LICENSE)"
|
text: '[MIT](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
2
.licenses/npm/before-after-hook.dep.yml
generated
2
.licenses/npm/before-after-hook.dep.yml
generated
@@ -210,5 +210,5 @@ licenses:
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[Apache 2.0](LICENSE)"
|
text: '[Apache 2.0](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
2
.licenses/npm/deprecation.dep.yml
generated
2
.licenses/npm/deprecation.dep.yml
generated
@@ -24,5 +24,5 @@ licenses:
|
|||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[ISC](LICENSE)"
|
text: '[ISC](LICENSE)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
2
.licenses/npm/universal-user-agent.dep.yml
generated
2
.licenses/npm/universal-user-agent.dep.yml
generated
@@ -16,5 +16,5 @@ licenses:
|
|||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: "[ISC](LICENSE.md)"
|
text: '[ISC](LICENSE.md)'
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @actions/actions-add-to-project
|
||||||
144
README.md
144
README.md
@@ -1,16 +1,29 @@
|
|||||||
# actions/add-to-project
|
# actions/add-to-project
|
||||||
|
|
||||||
🚨 **This action is a work in progress. Please do not use it except for
|
Use this action to automatically add the current issue or pull request to a [GitHub project](https://docs.github.com/en/issues/trying-out-the-new-projects-experience/about-projects).
|
||||||
experimentation until a release has been prepared.** 🚨
|
Note that this action does not support [GitHub projects (classic)](https://docs.github.com/en/issues/organizing-your-work-with-project-boards).
|
||||||
|
|
||||||
Use this action to automatically add issues to a GitHub Project. Note that this
|
## Current Status
|
||||||
is for [GitHub Projects
|
|
||||||
(beta)](https://docs.github.com/en/issues/trying-out-the-new-projects-experience/about-projects),
|
|
||||||
not the original GitHub Projects.
|
|
||||||
|
|
||||||
To use the action, create a workflow that runs when issues are opened in your
|
[](https://github.com/actions/add-to-project/actions/workflows/test.yml)
|
||||||
repository. Run this action in a step, optionally configuring any filters you
|
|
||||||
may want to add, such as only adding issues with certain labels.
|
> **NOTE:** This Action (currently) only supports auto-adding Issues/Pull Requests to a Project which lives in the same organization as your target Repository.
|
||||||
|
|
||||||
|
> **NOTE:** ⚠️ This action no longer uses the deprecated ProjectNext API. If you are looking for the old version of that action, use version [v0.0.5](https://github.com/actions/add-to-project/releases/tag/v0.0.5).
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
_See [action.yml](action.yml) for [metadata](https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions) that defines the inputs, outputs, and runs configuration for this action._
|
||||||
|
|
||||||
|
_For more information about workflows, see [Using workflows](https://docs.github.com/en/actions/using-workflows)._
|
||||||
|
|
||||||
|
Create a workflow that runs when Issues or Pull Requests are opened or labeled in your repository; this workflow also supports adding Issues to your project which are transferred into your repository. Optionally configure any filters you may want to add, such as only adding issues with certain labels. You may match labels with an `AND` or an `OR` operator, or exclude labels with a `NOT` operator.
|
||||||
|
|
||||||
|
Once you've configured your workflow, save it as a `.yml` file in your target Repository's `.github/workflows` directory.
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
#### Example Usage: Issue opened with labels `bug` OR `needs-triage`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: Add bugs to bugs project
|
name: Add bugs to bugs project
|
||||||
@@ -25,25 +38,110 @@ jobs:
|
|||||||
name: Add issue to project
|
name: Add issue to project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Pointing to a branch name generally isn't the safest way to refer to an action,
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
# but this is how you can use this action now before we've begun creating releases.
|
|
||||||
# Another option would be to point to a full commit SHA.
|
|
||||||
- uses: actions/add-to-project@main
|
|
||||||
with:
|
with:
|
||||||
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
labeled: bug
|
labeled: bug, needs-triage
|
||||||
|
label-operator: OR
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Example Usage: Adds all issues opened that do not include the label `bug` OR `needs-triage`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Adds all issues that don't include the 'bug' or 'needs-triage' labels to project board
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-to-project:
|
||||||
|
name: Add issue to project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
|
with:
|
||||||
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
|
labeled: bug, needs-triage
|
||||||
|
label-operator: NOT
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Example Usage: Pull Requests labeled with `needs-review` and `size/XL`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Add needs-review and size/XL pull requests to projects
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
add-to-project:
|
||||||
|
name: Add issue to project
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/add-to-project@RELEASE_VERSION
|
||||||
|
with:
|
||||||
|
project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
|
||||||
|
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
||||||
|
labeled: needs-review, size/XL
|
||||||
|
label-operator: AND
|
||||||
|
```
|
||||||
|
|
||||||
|
### Further reading and additional resources
|
||||||
|
|
||||||
|
- [actions/add-to-project](#actionsadd-to-project)
|
||||||
|
- [Current Status](#current-status)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [Example Usage: Issue opened with labels `bug` OR `needs-triage`](#example-usage-issue-opened-with-labels-bug-or-needs-triage)
|
||||||
|
- [Example Usage: Adds all issues opened that do not include the label `bug` OR `needs-triage`](#example-usage-adds-all-issues-opened-that-do-not-include-the-label-bug-or-needs-triage)
|
||||||
|
- [Example Usage: Pull Requests labeled with `needs-review` and `size/XL`](#example-usage-pull-requests-labeled-with-needs-review-and-sizexl)
|
||||||
|
- [Further reading and additional resources](#further-reading-and-additional-resources)
|
||||||
|
- [Inputs](#inputs)
|
||||||
|
- [Supported Events](#supported-events)
|
||||||
|
- [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository)
|
||||||
|
- [Development](#development)
|
||||||
|
- [Publish to a distribution branch](#publish-to-a-distribution-branch)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `project-url` is the URL of the GitHub Project to add issues to.
|
- <a name="project-url">`project-url`</a> **(required)** is the URL of the GitHub project to add issues to.
|
||||||
- `github-token` is a [personal access
|
_eg: `https://github.com/orgs|users/<ownerName>/projects/<projectNumber>`_
|
||||||
token](https://github.com/settings/tokens/new) with the `repo`, `write:org` and
|
- <a name="github-token">`github-token`</a> **(required)** is a [personal access
|
||||||
`read:org` scopes.
|
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes.
|
||||||
- `labeled` is a comma-separated list of labels. For an issue to be added to the
|
_See [Creating a PAT and adding it to your repository](#creating-a-pat-and-adding-it-to-your-repository) for more details_
|
||||||
project, it must have _one_ of the labels in the list. Omitting this key means
|
- <a name="labeled">`labeled`</a> **(optional)** is a comma-separated list of labels used to filter applicable issues. When this key is provided, an issue must have _one_ of the labels in the list to be added to the project. Omitting this key means that any issue will be added.
|
||||||
that all issues will be added.
|
- <a name="labeled">`label-operator`</a> **(optional)** is the behavior of the labels filter, either `AND`, `OR` or `NOT` that controls if the issue should be matched with `all` `labeled` input or any of them, default is `OR`.
|
||||||
|
|
||||||
|
## Supported Events
|
||||||
|
|
||||||
|
Currently this action supports the following [`issues` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues):
|
||||||
|
|
||||||
|
- `opened`
|
||||||
|
- `transferred`
|
||||||
|
- `labeled`
|
||||||
|
|
||||||
|
and the following [`pull_request` events](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request):
|
||||||
|
|
||||||
|
- `opened`
|
||||||
|
- `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.
|
||||||
|
|
||||||
|
## Creating a PAT and adding it to your repository
|
||||||
|
|
||||||
|
- create a new [personal access
|
||||||
|
token](https://github.com/settings/tokens/new) with `repo` and `project` scopes
|
||||||
|
_See [Creating a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) for more information_
|
||||||
|
|
||||||
|
- 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_
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -76,3 +174,7 @@ the "dist/" directory.
|
|||||||
```
|
```
|
||||||
|
|
||||||
Now, a release can be created from the branch containing the built action.
|
Now, a release can be created from the branch containing the built action.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|||||||
@@ -1,6 +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'
|
||||||
import {addToProject} from '../src/add-to-project'
|
|
||||||
|
import {addToProject, mustGetOwnerTypeQuery} from '../src/add-to-project'
|
||||||
|
|
||||||
describe('addToProject', () => {
|
describe('addToProject', () => {
|
||||||
let outputs: Record<string, string>
|
let outputs: Record<string, string>
|
||||||
@@ -29,18 +30,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,14 +50,14 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('adds matching issues with a label filter', async () => {
|
test('adds matching issues with a label filter without label-operator', async () => {
|
||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/github/projects/1',
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
labeled: 'bug'
|
labeled: 'bug, new'
|
||||||
})
|
})
|
||||||
|
|
||||||
github.context.payload = {
|
github.context.payload = {
|
||||||
@@ -71,18 +72,18 @@ describe('addToProject', () => {
|
|||||||
test: /getProject/,
|
test: /getProject/,
|
||||||
return: {
|
return: {
|
||||||
organization: {
|
organization: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: 'project-next-id'
|
id: 'project-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /addProjectNextItem/,
|
test: /addProjectV2ItemById/,
|
||||||
return: {
|
return: {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: 'project-next-item-id'
|
id: 'project-item-id'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,10 +92,53 @@ describe('addToProject', () => {
|
|||||||
|
|
||||||
await addToProject()
|
await addToProject()
|
||||||
|
|
||||||
expect(outputs.itemId).toEqual('project-next-item-id')
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('does not add un-matching issues with a label filter', async () => {
|
test('adds matching pull-requests with a label filter without label-operator', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
// eslint-disable-next-line camelcase
|
||||||
|
pull_request: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'bug'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('does not add un-matching issues with a label filter without label-operator', async () => {
|
||||||
mockGetInput({
|
mockGetInput({
|
||||||
'project-url': 'https://github.com/orgs/github/projects/1',
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
'github-token': 'gh_token',
|
'github-token': 'gh_token',
|
||||||
@@ -114,6 +158,449 @@ describe('addToProject', () => {
|
|||||||
expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it does not have one of the labels: bug`)
|
expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it does not have one of the labels: bug`)
|
||||||
expect(gqlMock).not.toHaveBeenCalled()
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('adds matching issues with labels filter with AND label-operator', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new',
|
||||||
|
'label-operator': 'AND'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'bug'}, {name: 'new'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('does not add un-matching issues with labels filter with AND label-operator', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new',
|
||||||
|
'label-operator': 'AND'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'bug'}, {name: 'other'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
|
const gqlMock = mockGraphQL()
|
||||||
|
await addToProject()
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it doesn't match all the labels: bug, new`)
|
||||||
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('does not add matching issues with labels filter with NOT label-operator', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new',
|
||||||
|
'label-operator': 'NOT'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'bug'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
|
const gqlMock = mockGraphQL()
|
||||||
|
await addToProject()
|
||||||
|
expect(infoSpy).toHaveBeenCalledWith(`Skipping issue 1 because it contains one of the labels: bug, new`)
|
||||||
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('adds issues that do not have labels present in the label list with NOT label-operator', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new',
|
||||||
|
'label-operator': 'NOT'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'other'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-next-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-next-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(outputs.itemId).toEqual('project-next-item-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('adds matching issues with multiple label filters', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'accessibility,backend,bug'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'accessibility'}, {name: 'backend'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gqlMock = mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(gqlMock).toHaveBeenCalled()
|
||||||
|
expect(infoSpy).not.toHaveBeenCalled()
|
||||||
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('does not add un-matching issues with multiple label filters', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'accessibility, backend, bug'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'data'}, {name: 'frontend'}, {name: 'improvement'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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`
|
||||||
|
)
|
||||||
|
expect(gqlMock).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('handles spaces and extra commas gracefully in label filter input', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'accessibility , backend ,, . , bug'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'accessibility'}, {name: 'backend'}, {name: 'bug'}],
|
||||||
|
'label-operator': 'AND'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gqlMock = mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const infoSpy = jest.spyOn(core, 'info')
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(gqlMock).toHaveBeenCalled()
|
||||||
|
expect(infoSpy).not.toHaveBeenCalled()
|
||||||
|
expect(outputs.itemId).toEqual('project-item-id')
|
||||||
|
})
|
||||||
|
|
||||||
|
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.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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>'
|
||||||
|
)
|
||||||
|
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: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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/github/projects/1',
|
||||||
|
'github-token': 'gh_token',
|
||||||
|
labeled: 'bug, new'
|
||||||
|
})
|
||||||
|
|
||||||
|
github.context.payload = {
|
||||||
|
issue: {
|
||||||
|
number: 1,
|
||||||
|
labels: [{name: 'bug'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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: $ownerName)'), {
|
||||||
|
ownerName: 'github',
|
||||||
|
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'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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: $ownerName)'), {
|
||||||
|
ownerName: 'monalisa',
|
||||||
|
projectNumber: 1
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
test('compares labels case-insensitively', async () => {
|
||||||
|
mockGetInput({
|
||||||
|
'project-url': 'https://github.com/orgs/github/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'}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mockGraphQL(
|
||||||
|
{
|
||||||
|
test: /getProject/,
|
||||||
|
return: {
|
||||||
|
organization: {
|
||||||
|
projectV2: {
|
||||||
|
id: 'project-next-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /addProjectV2ItemById/,
|
||||||
|
return: {
|
||||||
|
addProjectV2ItemById: {
|
||||||
|
item: {
|
||||||
|
id: 'project-next-item-id'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
await addToProject()
|
||||||
|
|
||||||
|
expect(outputs.itemId).toEqual('project-next-item-id')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('mustGetOwnerTypeQuery', () => {
|
||||||
|
test('returns organization for orgs ownerType', async () => {
|
||||||
|
const ownerTypeQuery = mustGetOwnerTypeQuery('orgs')
|
||||||
|
|
||||||
|
expect(ownerTypeQuery).toEqual('organization')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('returns user for users ownerType', async () => {
|
||||||
|
const ownerTypeQuery = mustGetOwnerTypeQuery('users')
|
||||||
|
|
||||||
|
expect(ownerTypeQuery).toEqual('user')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('throws an error when an unsupported ownerType is set', async () => {
|
||||||
|
expect(() => {
|
||||||
|
mustGetOwnerTypeQuery('unknown')
|
||||||
|
}).toThrow(`Unsupported ownerType: unknown. Must be one of 'orgs' or 'users'`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function mockGetInput(mocks: Record<string, string>): jest.SpyInstance {
|
function mockGetInput(mocks: Record<string, string>): jest.SpyInstance {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
name: Add to Project
|
name: Add To GitHub projects
|
||||||
description: Automatically add issues and PRs to GitHub projects
|
description: Automatically add issues and PRs to GitHub projects
|
||||||
author: GitHub
|
author: GitHub
|
||||||
|
branding:
|
||||||
|
icon: table
|
||||||
inputs:
|
inputs:
|
||||||
project-url:
|
project-url:
|
||||||
required: true
|
required: true
|
||||||
@@ -11,6 +13,9 @@ inputs:
|
|||||||
labeled:
|
labeled:
|
||||||
required: false
|
required: false
|
||||||
description: A comma-separated list of labels to use as a filter for issue to be added
|
description: A comma-separated list of labels to use as a filter for issue to be added
|
||||||
|
label-operator:
|
||||||
|
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)
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
773
dist/index.js
generated
vendored
773
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
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
2
dist/sourcemap-register.js
generated
vendored
2
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
2316
package-lock.json
generated
2316
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/add-to-project",
|
"name": "@actions/add-to-project",
|
||||||
"description": "Automatically issues and PRs to GitHub projects",
|
"description": "Automatically adds issues and PRs to GitHub projects",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"author": "GitHub and contributors",
|
"author": "GitHub and contributors",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.6.0",
|
"@actions/core": "^1.9.0",
|
||||||
"@actions/github": "^5.0.0"
|
"@actions/github": "^5.0.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0 <17.0.0",
|
"node": ">=16.0.0 <17.0.0",
|
||||||
@@ -13,19 +13,19 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@github/prettier-config": "^0.0.4",
|
"@github/prettier-config": "^0.0.4",
|
||||||
"@types/jest": "^27.4.0",
|
"@types/jest": "^27.5.0",
|
||||||
"@types/node": "^12.12.6",
|
"@types/node": "~16.11.45",
|
||||||
"@typescript-eslint/parser": "^5.10.2",
|
"@typescript-eslint/parser": "^5.30.7",
|
||||||
"@vercel/ncc": "^0.33.1",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"concurrently": "^7.0.0",
|
"concurrently": "^7.3.0",
|
||||||
"eslint": "^8.8.0",
|
"eslint": "^8.20.0",
|
||||||
"eslint-plugin-github": "^4.3.5",
|
"eslint-plugin-github": "^4.3.6",
|
||||||
"eslint-plugin-jest": "^26.0.0",
|
"eslint-plugin-jest": "^26.6.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"jest": "^27.4.7",
|
"jest": "^27.5.1",
|
||||||
"prettier": "2.5.1",
|
"prettier": "2.7.1",
|
||||||
"ts-jest": "^27.1.3",
|
"ts-jest": "^27.1.4",
|
||||||
"typescript": "^4.5.5"
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
|
|||||||
@@ -8,21 +8,21 @@ const urlParse =
|
|||||||
|
|
||||||
interface ProjectNodeIDResponse {
|
interface ProjectNodeIDResponse {
|
||||||
organization?: {
|
organization?: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
user?: {
|
user?: {
|
||||||
projectNext: {
|
projectV2: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ProjectAddItemResponse {
|
interface ProjectAddItemResponse {
|
||||||
addProjectNextItem: {
|
addProjectV2ItemById: {
|
||||||
projectNextItem: {
|
item: {
|
||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,20 +35,30 @@ export async function addToProject(): Promise<void> {
|
|||||||
core
|
core
|
||||||
.getInput('labeled')
|
.getInput('labeled')
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(l => l.trim())
|
.map(l => l.trim().toLowerCase())
|
||||||
.filter(l => l.length > 0) ?? []
|
.filter(l => l.length > 0) ?? []
|
||||||
|
const labelOperator = core.getInput('label-operator').trim().toLocaleLowerCase()
|
||||||
|
|
||||||
const octokit = github.getOctokit(ghToken)
|
const octokit = github.getOctokit(ghToken)
|
||||||
|
|
||||||
const urlMatch = projectUrl.match(urlParse)
|
const urlMatch = projectUrl.match(urlParse)
|
||||||
const issue = github.context.payload.issue ?? github.context.payload.pull_request
|
const issue = github.context.payload.issue ?? github.context.payload.pull_request
|
||||||
const issueLabels: string[] = (issue?.labels ?? []).map((l: {name: string}) => l.name)
|
const issueLabels: string[] = (issue?.labels ?? []).map((l: {name: string}) => l.name.toLowerCase())
|
||||||
|
|
||||||
// Ensure the issue matches our `labeled` filter, if provided.
|
// Ensure the issue matches our `labeled` filter based on the label-operator.
|
||||||
if (labeled.length > 0) {
|
if (labelOperator === 'and') {
|
||||||
const hasLabel = issueLabels.some(l => labeled.includes(l))
|
if (!labeled.every(l => issueLabels.includes(l))) {
|
||||||
|
core.info(`Skipping issue ${issue?.number} because it doesn't match all the labels: ${labeled.join(', ')}`)
|
||||||
if (!hasLabel) {
|
return
|
||||||
|
}
|
||||||
|
} else if (labelOperator === 'not') {
|
||||||
|
if (labeled.length > 0 && issueLabels.some(l => labeled.includes(l))) {
|
||||||
|
core.info(`Skipping issue ${issue?.number} because it contains one of the labels: ${labeled.join(', ')}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (labeled.length > 0 && !issueLabels.some(l => labeled.includes(l))) {
|
||||||
core.info(`Skipping issue ${issue?.number} because it does not have one of the labels: ${labeled.join(', ')}`)
|
core.info(`Skipping issue ${issue?.number} because it does not have one of the labels: ${labeled.join(', ')}`)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +84,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
const idResp = await octokit.graphql<ProjectNodeIDResponse>(
|
const idResp = await octokit.graphql<ProjectNodeIDResponse>(
|
||||||
`query getProject($ownerName: String!, $projectNumber: Int!) {
|
`query getProject($ownerName: String!, $projectNumber: Int!) {
|
||||||
${ownerTypeQuery}(login: $ownerName) {
|
${ownerTypeQuery}(login: $ownerName) {
|
||||||
projectNext(number: $projectNumber) {
|
projectV2(number: $projectNumber) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +95,7 @@ export async function addToProject(): Promise<void> {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const projectId = idResp[ownerTypeQuery]?.projectNext.id
|
const projectId = idResp[ownerTypeQuery]?.projectV2.id
|
||||||
const contentId = issue?.node_id
|
const contentId = issue?.node_id
|
||||||
|
|
||||||
core.debug(`Project node ID: ${projectId}`)
|
core.debug(`Project node ID: ${projectId}`)
|
||||||
@@ -93,25 +103,25 @@ export async function addToProject(): Promise<void> {
|
|||||||
|
|
||||||
// Next, use the GraphQL API to add the issue to the project.
|
// Next, use the GraphQL API to add the issue to the project.
|
||||||
const addResp = await octokit.graphql<ProjectAddItemResponse>(
|
const addResp = await octokit.graphql<ProjectAddItemResponse>(
|
||||||
`mutation addIssueToProject($input: AddProjectNextItemInput!) {
|
`mutation addIssueToProject($input: AddProjectV2ItemByIdInput!) {
|
||||||
addProjectNextItem(input: $input) {
|
addProjectV2ItemById(input: $input) {
|
||||||
projectNextItem {
|
item {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
input: {
|
input: {
|
||||||
contentId,
|
projectId,
|
||||||
projectId
|
contentId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
core.setOutput('itemId', addResp.addProjectNextItem.projectNextItem.id)
|
core.setOutput('itemId', addResp.addProjectV2ItemById.item.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function mustGetOwnerTypeQuery(ownerType?: string): 'organization' | 'user' {
|
export function mustGetOwnerTypeQuery(ownerType?: string): 'organization' | 'user' {
|
||||||
const ownerTypeQuery = ownerType === 'orgs' ? 'organization' : ownerType === 'users' ? 'user' : null
|
const ownerTypeQuery = ownerType === 'orgs' ? 'organization' : ownerType === 'users' ? 'user' : null
|
||||||
|
|
||||||
if (!ownerTypeQuery) {
|
if (!ownerTypeQuery) {
|
||||||
|
|||||||
Reference in New Issue
Block a user