mirror of
https://github.com/actions/github-script.git
synced 2025-12-08 16:16:21 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47f7cf65b5 | ||
|
|
58579a2cbf | ||
|
|
8c2abf1707 | ||
|
|
ed05d35c66 | ||
|
|
bc192ff403 | ||
|
|
5c195044a2 | ||
|
|
bdd2dafb12 | ||
|
|
2d40ba5c82 | ||
|
|
3c58ce3675 | ||
|
|
ff0a9e81a8 | ||
|
|
9d620e45a4 | ||
|
|
e5156a8b84 | ||
|
|
b780942434 | ||
|
|
f035cea467 | ||
|
|
6bd37e1a50 | ||
|
|
9124ee04c3 | ||
|
|
28e5ebafd7 | ||
|
|
ce5d26b1ab | ||
|
|
91121b9cb3 | ||
|
|
ac77fc9f3f | ||
|
|
eb58336601 | ||
|
|
af3c0bbd72 | ||
|
|
fdf4916d13 | ||
|
|
89e42e73d1 | ||
|
|
e2ddba4dfc | ||
|
|
cf1dcb0bd5 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -1,3 +1,5 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push: {branches: main}
|
||||
pull_request: {branches: main}
|
||||
|
||||
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@@ -1,3 +1,5 @@
|
||||
name: Integration
|
||||
|
||||
on:
|
||||
push: {branches: main}
|
||||
|
||||
|
||||
30
.licenses/npm/@actions/core.dep.yml
generated
30
.licenses/npm/@actions/core.dep.yml
generated
@@ -1,30 +1,20 @@
|
||||
---
|
||||
name: "@actions/core"
|
||||
version: 1.2.4
|
||||
version: 1.2.6
|
||||
type: npm
|
||||
summary: Actions core lib
|
||||
homepage: https://github.com/actions/toolkit/tree/master/packages/core
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
text: |
|
||||
MIT License
|
||||
- sources: LICENSE.md
|
||||
text: |-
|
||||
The MIT License (MIT)
|
||||
|
||||
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:
|
||||
Copyright 2019 GitHub
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
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 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 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.
|
||||
notices: []
|
||||
|
||||
2
.licenses/npm/@octokit/auth-token.dep.yml
generated
2
.licenses/npm/@octokit/auth-token.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/auth-token"
|
||||
version: 2.4.2
|
||||
version: 2.4.3
|
||||
type: npm
|
||||
summary: GitHub API token authentication for browsers and Node.js
|
||||
homepage: https://github.com/octokit/auth-token.js#readme
|
||||
|
||||
2
.licenses/npm/@octokit/core.dep.yml
generated
2
.licenses/npm/@octokit/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/core"
|
||||
version: 3.1.2
|
||||
version: 3.2.1
|
||||
type: npm
|
||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||
homepage: https://github.com/octokit/core.js#readme
|
||||
|
||||
2
.licenses/npm/@octokit/endpoint.dep.yml
generated
2
.licenses/npm/@octokit/endpoint.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/endpoint"
|
||||
version: 6.0.5
|
||||
version: 6.0.9
|
||||
type: npm
|
||||
summary: Turns REST API endpoints into generic request options
|
||||
homepage: https://github.com/octokit/endpoint.js#readme
|
||||
|
||||
2
.licenses/npm/@octokit/graphql.dep.yml
generated
2
.licenses/npm/@octokit/graphql.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/graphql"
|
||||
version: 4.5.4
|
||||
version: 4.5.7
|
||||
type: npm
|
||||
summary: GitHub GraphQL API client for browsers and Node
|
||||
homepage: https://github.com/octokit/graphql.js#readme
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-paginate-rest"
|
||||
version: 2.3.0
|
||||
version: 2.6.0
|
||||
type: npm
|
||||
summary: Octokit plugin to paginate REST API endpoint responses
|
||||
homepage: https://github.com/octokit/plugin-paginate-rest.js#readme
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-rest-endpoint-methods"
|
||||
version: 4.1.2
|
||||
version: 4.2.1
|
||||
type: npm
|
||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||
homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme
|
||||
|
||||
2
.licenses/npm/@octokit/request-error.dep.yml
generated
2
.licenses/npm/@octokit/request-error.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/request-error"
|
||||
version: 2.0.2
|
||||
version: 2.0.3
|
||||
type: npm
|
||||
summary: Error class for Octokit request errors
|
||||
homepage: https://github.com/octokit/request-error.js#readme
|
||||
|
||||
2
.licenses/npm/@octokit/request.dep.yml
generated
2
.licenses/npm/@octokit/request.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/request"
|
||||
version: 5.4.7
|
||||
version: 5.4.10
|
||||
type: npm
|
||||
summary: Send parameterized requests to GitHub’s APIs with sensible defaults in browsers
|
||||
and Node
|
||||
|
||||
2
.licenses/npm/@octokit/types.dep.yml
generated
2
.licenses/npm/@octokit/types.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/types"
|
||||
version: 5.4.1
|
||||
version: 5.5.0
|
||||
type: npm
|
||||
summary: Shared TypeScript definitions for Octokit projects
|
||||
homepage: https://github.com/octokit/types.ts#readme
|
||||
|
||||
2
.licenses/npm/is-plain-object.dep.yml
generated
2
.licenses/npm/is-plain-object.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: is-plain-object
|
||||
version: 4.1.1
|
||||
version: 5.0.0
|
||||
type: npm
|
||||
summary: Returns true if an object was created by the `Object` constructor, or Object.create(null).
|
||||
homepage: https://github.com/jonschlinkert/is-plain-object
|
||||
|
||||
6
.licenses/npm/node-fetch.dep.yml
generated
6
.licenses/npm/node-fetch.dep.yml
generated
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: node-fetch
|
||||
version: 2.6.0
|
||||
version: 2.6.1
|
||||
type: npm
|
||||
summary: A light-weight module that brings window.fetch to node.js
|
||||
homepage: https://github.com/bitinn/node-fetch
|
||||
@@ -42,6 +42,10 @@ licenses:
|
||||
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
|
||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
|
||||
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
|
||||
[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
|
||||
[discord-url]: https://discord.gg/Zxbndcm
|
||||
[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
|
||||
[opencollective-url]: https://opencollective.com/node-fetch
|
||||
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
||||
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
||||
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
||||
|
||||
237
README.md
237
README.md
@@ -1,4 +1,8 @@
|
||||
# github-script   
|
||||
# actions/github-script
|
||||
|
||||
[](https://github.com/actions/github-script/actions?query=workflow%3AIntegration+branch%3Amain+event%3Apush)
|
||||
[](https://github.com/actions/github-script/actions?query=workflow%3ACI+branch%3Amain+event%3Apush)
|
||||
[](https://github.com/actions/github-script/actions?query=workflow%3ALicensed+branch%3Amain+event%3Apush)
|
||||
|
||||
This action makes it easy to quickly write a script in your workflow that
|
||||
uses the GitHub API and the workflow run context.
|
||||
@@ -8,7 +12,7 @@ input should be the body of an asynchronous function call. The following
|
||||
arguments will be provided:
|
||||
|
||||
- `github` A pre-authenticated
|
||||
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
||||
[octokit/core.js](https://github.com/octokit/core.js#readme) client with REST endpoints and pagination plugins
|
||||
- `context` An object containing the [context of the workflow
|
||||
run](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts)
|
||||
- `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core) package
|
||||
@@ -182,230 +186,39 @@ using the API.)_
|
||||
This will print the full diff object in the screen; `result.data` will
|
||||
contain the actual diff text.
|
||||
|
||||
### Run a separate file
|
||||
### Run custom GraphQL queries
|
||||
|
||||
If you don't want to inline your entire script that you want to run, you can
|
||||
use a separate JavaScript module in your repository like so:
|
||||
You can use the `github.graphql` object to run custom GraphQL queries against the GitHub API.
|
||||
|
||||
```yaml
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
echo-input:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/github-script@v2
|
||||
with:
|
||||
script: |
|
||||
const script = require(`${process.env.GITHUB_WORKSPACE}/path/to/script.js`)
|
||||
console.log(script({github, context}))
|
||||
```
|
||||
|
||||
*Note that the script path given to `require()` must be an **absolute path** in this case, hence using [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables).*
|
||||
|
||||
And then export a function from your module:
|
||||
|
||||
```javascript
|
||||
module.exports = (github, context) => {
|
||||
return context.payload.client_payload.value
|
||||
}
|
||||
```
|
||||
|
||||
You can also use async functions in this manner, as long as you `await` it in
|
||||
the inline script.
|
||||
|
||||
Note that because you can't `require` things like the GitHub context or
|
||||
Actions Toolkit libraries, you'll want to pass them as arguments to your
|
||||
external function.
|
||||
|
||||
Additionally, you'll want to use the [checkout
|
||||
action](https://github.com/actions/checkout) to make sure your script file is
|
||||
available.
|
||||
|
||||
|
||||
This action makes it easy to quickly write a script in your workflow that
|
||||
uses the GitHub API and the workflow run context.
|
||||
|
||||
In order to use this action, a `script` input is provided. The value of that
|
||||
input should be the body of an asynchronous function call. The following
|
||||
arguments will be provided:
|
||||
|
||||
- `github` A pre-authenticated
|
||||
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
||||
- `context` An object containing the [context of the workflow
|
||||
run](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts)
|
||||
- `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/main/packages/core) package
|
||||
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/io) package
|
||||
|
||||
Since the `script` is just a function body, these values will already be
|
||||
defined, so you don't have to (see examples below).
|
||||
|
||||
See [octokit/rest.js](https://octokit.github.io/rest.js/) for the API client
|
||||
documentation.
|
||||
|
||||
**Note** This action is still a bit of an experiment—the API may change in
|
||||
future versions. 🙂
|
||||
|
||||
## Development
|
||||
|
||||
See [development.md](/docs/development.md).
|
||||
|
||||
## Reading step results
|
||||
|
||||
The return value of the script will be in the step's outputs under the
|
||||
"result" key.
|
||||
|
||||
```yaml
|
||||
- uses: actions/github-script@v3
|
||||
id: set-result
|
||||
with:
|
||||
script: return "Hello!"
|
||||
result-encoding: string
|
||||
- name: Get result
|
||||
run: echo "${{steps.set-result.outputs.result}}"
|
||||
```
|
||||
|
||||
See ["Result encoding"](#result-encoding) for details on how the encoding of
|
||||
these outputs can be changed.
|
||||
|
||||
## Result encoding
|
||||
|
||||
By default, the JSON-encoded return value of the function is set as the "result" in the
|
||||
output of a github-script step. For some workflows, string encoding is preferred. This option can be set using the
|
||||
`result-encoding` input:
|
||||
|
||||
```yaml
|
||||
- uses: actions/github-script@v3
|
||||
id: my-script
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
result-encoding: string
|
||||
script: return "I will be string (not JSON) encoded!"
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Note that `github-token` is optional in this action, and the input is there
|
||||
in case you need to use a non-default token.
|
||||
|
||||
By default, github-script will use the token provided to your workflow.
|
||||
|
||||
### Comment on an issue
|
||||
|
||||
```yaml
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
comment:
|
||||
list-packages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '👋 Thanks for reporting!'
|
||||
})
|
||||
```
|
||||
|
||||
### Apply a label to an issue
|
||||
|
||||
```yaml
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
apply-label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
github.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: ['Triage']
|
||||
})
|
||||
```
|
||||
|
||||
### Welcome a first-time contributor
|
||||
|
||||
```yaml
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
// Get a list of all issues created by the PR opener
|
||||
// See: https://octokit.github.io/rest.js/#pagination
|
||||
const creator = context.payload.sender.login
|
||||
const opts = github.issues.listForRepo.endpoint.merge({
|
||||
...context.issue,
|
||||
creator,
|
||||
state: 'all'
|
||||
})
|
||||
const issues = await github.paginate(opts)
|
||||
|
||||
for (const issue of issues) {
|
||||
if (issue.number === context.issue.number) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (issue.pull_request) {
|
||||
return // Creator is already a contributor.
|
||||
const query = `query($owner:String!, $name:String!) {
|
||||
repository(owner:$owner, name:$name){
|
||||
issues(first:100, labels: [$label]) {
|
||||
nodes {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}`;
|
||||
const variables = {
|
||||
owner: context.repo.owner,
|
||||
name: context.repo.repo,
|
||||
label: 'wontfix'
|
||||
}
|
||||
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'Welcome, new contributor!'
|
||||
})
|
||||
```
|
||||
|
||||
### Download data from a URL
|
||||
|
||||
You can use the `github` object to access the Octokit API. For
|
||||
instance, `github.request`
|
||||
|
||||
```yaml
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
diff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const diff_url = context.payload.pull_request.diff_url
|
||||
const result = await github.request(diff_url)
|
||||
const result = await github.graphql(query, variables)
|
||||
console.log(result)
|
||||
|
||||
```
|
||||
|
||||
_(Note that this particular example only works for a public URL, where the
|
||||
diff URL is publicly accessible. Getting the diff for a private URL requires
|
||||
using the API.)_
|
||||
|
||||
This will print the full diff object in the screen; `result.data` will
|
||||
contain the actual diff text.
|
||||
|
||||
### Run a separate file
|
||||
|
||||
If you don't want to inline your entire script that you want to run, you can
|
||||
@@ -426,12 +239,12 @@ jobs:
|
||||
console.log(script({github, context}))
|
||||
```
|
||||
|
||||
*Note that the script path given to `require()` must be an **absolute path** in this case, hence using [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables).*
|
||||
_Note that the script path given to `require()` must be an **absolute path** in this case, hence using [`GITHUB_WORKSPACE`](https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables)._
|
||||
|
||||
And then export a function from your module:
|
||||
|
||||
```javascript
|
||||
module.exports = (github, context) => {
|
||||
module.exports = ({github, context}) => {
|
||||
return context.payload.client_payload.value
|
||||
}
|
||||
```
|
||||
|
||||
489
dist/index.js
vendored
489
dist/index.js
vendored
@@ -211,11 +211,7 @@ const Endpoints = {
|
||||
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
|
||||
},
|
||||
apps: {
|
||||
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||
checkToken: ["POST /applications/{client_id}/token"],
|
||||
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
|
||||
mediaType: {
|
||||
@@ -223,81 +219,29 @@ const Endpoints = {
|
||||
}
|
||||
}],
|
||||
createFromManifest: ["POST /app-manifests/{code}/conversions"],
|
||||
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"],
|
||||
deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
|
||||
deleteInstallation: ["DELETE /app/installations/{installation_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
deleteInstallation: ["DELETE /app/installations/{installation_id}"],
|
||||
deleteToken: ["DELETE /applications/{client_id}/token"],
|
||||
getAuthenticated: ["GET /app", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getBySlug: ["GET /apps/{app_slug}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getInstallation: ["GET /app/installations/{installation_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getOrgInstallation: ["GET /orgs/{org}/installation", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getAuthenticated: ["GET /app"],
|
||||
getBySlug: ["GET /apps/{app_slug}"],
|
||||
getInstallation: ["GET /app/installations/{installation_id}"],
|
||||
getOrgInstallation: ["GET /orgs/{org}/installation"],
|
||||
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
|
||||
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
|
||||
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
||||
getUserInstallation: ["GET /users/{username}/installation", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getUserInstallation: ["GET /users/{username}/installation"],
|
||||
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
||||
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallations: ["GET /app/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallationsForAuthenticatedUser: ["GET /user/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
|
||||
listInstallations: ["GET /app/installations"],
|
||||
listInstallationsForAuthenticatedUser: ["GET /user/installations"],
|
||||
listPlans: ["GET /marketplace_listing/plans"],
|
||||
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
|
||||
listReposAccessibleToInstallation: ["GET /installation/repositories", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listReposAccessibleToInstallation: ["GET /installation/repositories"],
|
||||
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
||||
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||
resetToken: ["PATCH /applications/{client_id}/token"],
|
||||
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
||||
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
|
||||
@@ -369,8 +313,15 @@ const Endpoints = {
|
||||
}]
|
||||
},
|
||||
codeScanning: {
|
||||
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"],
|
||||
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"]
|
||||
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
|
||||
renamedParameters: {
|
||||
alert_id: "alert_number"
|
||||
}
|
||||
}],
|
||||
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
|
||||
listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
|
||||
updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"],
|
||||
uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
|
||||
},
|
||||
codesOfConduct: {
|
||||
getAllCodesOfConduct: ["GET /codes_of_conduct", {
|
||||
@@ -612,11 +563,7 @@ const Endpoints = {
|
||||
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
||||
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
||||
list: ["GET /organizations"],
|
||||
listAppInstallations: ["GET /orgs/{org}/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listAppInstallations: ["GET /orgs/{org}/installations"],
|
||||
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
||||
listForAuthenticatedUser: ["GET /user/orgs"],
|
||||
listForUser: ["GET /users/{username}/orgs"],
|
||||
@@ -1229,7 +1176,7 @@ const Endpoints = {
|
||||
}
|
||||
};
|
||||
|
||||
const VERSION = "4.1.2";
|
||||
const VERSION = "4.2.1";
|
||||
|
||||
function endpointsToMethods(octokit, endpointsMap) {
|
||||
const newMethods = {};
|
||||
@@ -1428,6 +1375,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = __webpack_require__(351);
|
||||
const file_command_1 = __webpack_require__(717);
|
||||
const utils_1 = __webpack_require__(278);
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
/**
|
||||
@@ -1454,9 +1403,17 @@ var ExitCode;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = command_1.toCommandValue(val);
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@@ -1472,7 +1429,13 @@ exports.setSecret = setSecret;
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
@@ -1642,7 +1605,7 @@ exports.getState = getState;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const VERSION = "2.3.0";
|
||||
const VERSION = "2.6.0";
|
||||
|
||||
/**
|
||||
* Some “list” response that can be paginated have a different response structure
|
||||
@@ -1695,26 +1658,23 @@ function iterator(octokit, route, parameters) {
|
||||
let url = options.url;
|
||||
return {
|
||||
[Symbol.asyncIterator]: () => ({
|
||||
next() {
|
||||
if (!url) {
|
||||
return Promise.resolve({
|
||||
done: true
|
||||
});
|
||||
}
|
||||
|
||||
return requestMethod({
|
||||
async next() {
|
||||
if (!url) return {
|
||||
done: true
|
||||
};
|
||||
const response = await requestMethod({
|
||||
method,
|
||||
url,
|
||||
headers
|
||||
}).then(normalizePaginatedListResponse).then(response => {
|
||||
// `response.headers.link` format:
|
||||
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
|
||||
// sets `url` to undefined if "next" URL is not present or `link` header is not set
|
||||
url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
|
||||
return {
|
||||
value: response
|
||||
};
|
||||
});
|
||||
const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format:
|
||||
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
|
||||
// sets `url` to undefined if "next" URL is not present or `link` header is not set
|
||||
|
||||
url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
|
||||
return {
|
||||
value: normalizedResponse
|
||||
};
|
||||
}
|
||||
|
||||
})
|
||||
@@ -1752,6 +1712,10 @@ function gather(octokit, results, iterator, mapFn) {
|
||||
});
|
||||
}
|
||||
|
||||
const composePaginateRest = Object.assign(paginate, {
|
||||
iterator
|
||||
});
|
||||
|
||||
/**
|
||||
* @param octokit Octokit instance
|
||||
* @param options Options passed to Octokit constructor
|
||||
@@ -1766,6 +1730,7 @@ function paginateRest(octokit) {
|
||||
}
|
||||
paginateRest.VERSION = VERSION;
|
||||
|
||||
exports.composePaginateRest = composePaginateRest;
|
||||
exports.paginateRest = paginateRest;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
@@ -2112,18 +2077,18 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
||||
|
||||
var endpoint = __webpack_require__(440);
|
||||
var universalUserAgent = __webpack_require__(429);
|
||||
var isPlainObject = _interopDefault(__webpack_require__(840));
|
||||
var isPlainObject = __webpack_require__(287);
|
||||
var nodeFetch = _interopDefault(__webpack_require__(467));
|
||||
var requestError = __webpack_require__(537);
|
||||
|
||||
const VERSION = "5.4.7";
|
||||
const VERSION = "5.4.10";
|
||||
|
||||
function getBufferResponse(response) {
|
||||
return response.arrayBuffer();
|
||||
}
|
||||
|
||||
function fetchWrapper(requestOptions) {
|
||||
if (isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
||||
if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
|
||||
requestOptions.body = JSON.stringify(requestOptions.body);
|
||||
}
|
||||
|
||||
@@ -2254,6 +2219,78 @@ exports.request = request;
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 278:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 287:
|
||||
/***/ (function(__unusedmodule, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function isObject(o) {
|
||||
return Object.prototype.toString.call(o) === '[object Object]';
|
||||
}
|
||||
|
||||
function isPlainObject(o) {
|
||||
var ctor,prot;
|
||||
|
||||
if (isObject(o) === false) return false;
|
||||
|
||||
// If has modified constructor
|
||||
ctor = o.constructor;
|
||||
if (ctor === undefined) return true;
|
||||
|
||||
// If has modified prototype
|
||||
prot = ctor.prototype;
|
||||
if (isObject(prot) === false) return false;
|
||||
|
||||
// If constructor does not have an Object-specific method
|
||||
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Most likely a plain Object
|
||||
return true;
|
||||
}
|
||||
|
||||
exports.isPlainObject = isPlainObject;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 294:
|
||||
@@ -2335,6 +2372,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const utils_1 = __webpack_require__(278);
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@@ -2388,28 +2426,14 @@ class Command {
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
function escapeData(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
@@ -2808,9 +2832,7 @@ exports.getOctokit = getOctokit;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var isPlainObject = _interopDefault(__webpack_require__(840));
|
||||
var isPlainObject = __webpack_require__(287);
|
||||
var universalUserAgent = __webpack_require__(429);
|
||||
|
||||
function lowercaseKeys(object) {
|
||||
@@ -2827,7 +2849,7 @@ function lowercaseKeys(object) {
|
||||
function mergeDeep(defaults, options) {
|
||||
const result = Object.assign({}, defaults);
|
||||
Object.keys(options).forEach(key => {
|
||||
if (isPlainObject(options[key])) {
|
||||
if (isPlainObject.isPlainObject(options[key])) {
|
||||
if (!(key in defaults)) Object.assign(result, {
|
||||
[key]: options[key]
|
||||
});else result[key] = mergeDeep(defaults[key], options[key]);
|
||||
@@ -2840,6 +2862,16 @@ function mergeDeep(defaults, options) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function removeUndefinedProperties(obj) {
|
||||
for (const key in obj) {
|
||||
if (obj[key] === undefined) {
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function merge(defaults, route, options) {
|
||||
if (typeof route === "string") {
|
||||
let [method, url] = route.split(" ");
|
||||
@@ -2854,7 +2886,10 @@ function merge(defaults, route, options) {
|
||||
} // lowercase header names before merging with defaults to avoid duplicates
|
||||
|
||||
|
||||
options.headers = lowercaseKeys(options.headers);
|
||||
options.headers = lowercaseKeys(options.headers); // remove properties with undefined values before merging
|
||||
|
||||
removeUndefinedProperties(options);
|
||||
removeUndefinedProperties(options.headers);
|
||||
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
|
||||
|
||||
if (defaults && defaults.mediaType.previews.length) {
|
||||
@@ -3076,7 +3111,7 @@ function parse(options) {
|
||||
// https://fetch.spec.whatwg.org/#methods
|
||||
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
|
||||
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{+$1}");
|
||||
let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
|
||||
let headers = Object.assign({}, options.headers);
|
||||
let body;
|
||||
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
|
||||
@@ -3090,9 +3125,9 @@ function parse(options) {
|
||||
|
||||
const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
|
||||
const remainingParameters = omit(parameters, omittedParameters);
|
||||
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
|
||||
const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
|
||||
|
||||
if (!isBinaryRequset) {
|
||||
if (!isBinaryRequest) {
|
||||
if (options.mediaType.format) {
|
||||
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
|
||||
headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`)).join(",");
|
||||
@@ -3161,7 +3196,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
||||
});
|
||||
}
|
||||
|
||||
const VERSION = "6.0.5";
|
||||
const VERSION = "6.0.9";
|
||||
|
||||
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.
|
||||
// So we use RequestParameters and add method as additional required property.
|
||||
@@ -3724,6 +3759,12 @@ function convertBody(buffer, headers) {
|
||||
// html4
|
||||
if (!res && str) {
|
||||
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
|
||||
if (!res) {
|
||||
res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
|
||||
if (res) {
|
||||
res.pop(); // drop last quote
|
||||
}
|
||||
}
|
||||
|
||||
if (res) {
|
||||
res = /charset=(.*)/i.exec(res.pop());
|
||||
@@ -4731,7 +4772,7 @@ function fetch(url, opts) {
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
case 'error':
|
||||
reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect'));
|
||||
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
|
||||
finalize();
|
||||
return;
|
||||
case 'manual':
|
||||
@@ -4770,7 +4811,8 @@ function fetch(url, opts) {
|
||||
method: request.method,
|
||||
body: request.body,
|
||||
signal: request.signal,
|
||||
timeout: request.timeout
|
||||
timeout: request.timeout,
|
||||
size: request.size
|
||||
};
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
@@ -5058,7 +5100,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
||||
var request = __webpack_require__(234);
|
||||
var universalUserAgent = __webpack_require__(429);
|
||||
|
||||
const VERSION = "4.5.4";
|
||||
const VERSION = "4.5.7";
|
||||
|
||||
class GraphqlError extends Error {
|
||||
constructor(request, response) {
|
||||
@@ -5081,13 +5123,18 @@ class GraphqlError extends Error {
|
||||
}
|
||||
|
||||
const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
|
||||
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
|
||||
function graphql(request, query, options) {
|
||||
options = typeof query === "string" ? options = Object.assign({
|
||||
if (typeof query === "string" && options && "query" in options) {
|
||||
return Promise.reject(new Error(`[@octokit/graphql] "query" cannot be used as variable name`));
|
||||
}
|
||||
|
||||
const parsedOptions = typeof query === "string" ? Object.assign({
|
||||
query
|
||||
}, options) : options = query;
|
||||
const requestOptions = Object.keys(options).reduce((result, key) => {
|
||||
}, options) : query;
|
||||
const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
|
||||
if (NON_VARIABLE_OPTIONS.includes(key)) {
|
||||
result[key] = options[key];
|
||||
result[key] = parsedOptions[key];
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -5095,9 +5142,17 @@ function graphql(request, query, options) {
|
||||
result.variables = {};
|
||||
}
|
||||
|
||||
result.variables[key] = options[key];
|
||||
result.variables[key] = parsedOptions[key];
|
||||
return result;
|
||||
}, {});
|
||||
}, {}); // workaround for GitHub Enterprise baseUrl set with /api/v3 suffix
|
||||
// https://github.com/octokit/auth-app.js/issues/111#issuecomment-657610451
|
||||
|
||||
const baseUrl = parsedOptions.baseUrl || request.endpoint.DEFAULTS.baseUrl;
|
||||
|
||||
if (GHES_V3_SUFFIX_REGEX.test(baseUrl)) {
|
||||
requestOptions.url = baseUrl.replace(GHES_V3_SUFFIX_REGEX, "/api/graphql");
|
||||
}
|
||||
|
||||
return request(requestOptions).then(response => {
|
||||
if (response.data.errors) {
|
||||
const headers = {};
|
||||
@@ -5254,6 +5309,42 @@ module.exports.Singular = Hook.Singular
|
||||
module.exports.Collection = Hook.Collection
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 717:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// For internal use, subject to change.
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const utils_1 = __webpack_require__(278);
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 720:
|
||||
@@ -5353,56 +5444,43 @@ var request = __webpack_require__(234);
|
||||
var graphql = __webpack_require__(668);
|
||||
var authToken = __webpack_require__(334);
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
function _objectWithoutPropertiesLoose(source, excluded) {
|
||||
if (source == null) return {};
|
||||
var target = {};
|
||||
var sourceKeys = Object.keys(source);
|
||||
var key, i;
|
||||
|
||||
for (i = 0; i < sourceKeys.length; i++) {
|
||||
key = sourceKeys[i];
|
||||
if (excluded.indexOf(key) >= 0) continue;
|
||||
target[key] = source[key];
|
||||
}
|
||||
|
||||
return obj;
|
||||
return target;
|
||||
}
|
||||
|
||||
function ownKeys(object, enumerableOnly) {
|
||||
var keys = Object.keys(object);
|
||||
function _objectWithoutProperties(source, excluded) {
|
||||
if (source == null) return {};
|
||||
|
||||
var target = _objectWithoutPropertiesLoose(source, excluded);
|
||||
|
||||
var key, i;
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
var symbols = Object.getOwnPropertySymbols(object);
|
||||
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
||||
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
||||
});
|
||||
keys.push.apply(keys, symbols);
|
||||
}
|
||||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
function _objectSpread2(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
|
||||
if (i % 2) {
|
||||
ownKeys(Object(source), true).forEach(function (key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
} else if (Object.getOwnPropertyDescriptors) {
|
||||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
||||
} else {
|
||||
ownKeys(Object(source)).forEach(function (key) {
|
||||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
||||
});
|
||||
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
||||
key = sourceSymbolKeys[i];
|
||||
if (excluded.indexOf(key) >= 0) continue;
|
||||
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
const VERSION = "3.1.2";
|
||||
const VERSION = "3.2.1";
|
||||
|
||||
class Octokit {
|
||||
constructor(options = {}) {
|
||||
@@ -5434,9 +5512,7 @@ class Octokit {
|
||||
}
|
||||
|
||||
this.request = request.request.defaults(requestDefaults);
|
||||
this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, {
|
||||
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api")
|
||||
}));
|
||||
this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
|
||||
this.log = Object.assign({
|
||||
debug: () => {},
|
||||
info: () => {},
|
||||
@@ -5444,7 +5520,7 @@ class Octokit {
|
||||
error: console.error.bind(console)
|
||||
}, options.log);
|
||||
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
|
||||
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.
|
||||
// (2) If only `options.auth` is set, use the default token authentication strategy.
|
||||
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
|
||||
// TODO: type `options.auth` based on `options.authStrategy`.
|
||||
@@ -5463,8 +5539,21 @@ class Octokit {
|
||||
this.auth = auth;
|
||||
}
|
||||
} else {
|
||||
const auth = options.authStrategy(Object.assign({
|
||||
request: this.request
|
||||
const {
|
||||
authStrategy
|
||||
} = options,
|
||||
otherOptions = _objectWithoutProperties(options, ["authStrategy"]);
|
||||
|
||||
const auth = authStrategy(Object.assign({
|
||||
request: this.request,
|
||||
log: this.log,
|
||||
// we pass the current octokit instance as well as its constructor options
|
||||
// to allow for authentication strategies that return a new octokit instance
|
||||
// that shares the same internal state as the current one. The original
|
||||
// requirement for this was the "event-octokit" authentication strategy
|
||||
// of https://github.com/probot/octokit-auth-probot.
|
||||
octokit: this,
|
||||
octokitOptions: otherOptions
|
||||
}, options.auth)); // @ts-ignore ¯\_(ツ)_/¯
|
||||
|
||||
hook.wrap("request", auth.hook);
|
||||
@@ -5552,50 +5641,6 @@ function removeHook (state, name, method) {
|
||||
|
||||
module.exports = require("url");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 840:
|
||||
/***/ (function(module) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
|
||||
function isObject(o) {
|
||||
return Object.prototype.toString.call(o) === '[object Object]';
|
||||
}
|
||||
|
||||
function isPlainObject(o) {
|
||||
var ctor,prot;
|
||||
|
||||
if (isObject(o) === false) return false;
|
||||
|
||||
// If has modified constructor
|
||||
ctor = o.constructor;
|
||||
if (ctor === undefined) return true;
|
||||
|
||||
// If has modified prototype
|
||||
prot = ctor.prototype;
|
||||
if (isObject(prot) === false) return false;
|
||||
|
||||
// If constructor does not have an Object-specific method
|
||||
if (prot.hasOwnProperty('isPrototypeOf') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Most likely a plain Object
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isPlainObject;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 875:
|
||||
|
||||
@@ -22,7 +22,7 @@ well.
|
||||
|
||||
Releases are done manually, for now:
|
||||
|
||||
1. Ensure that the build is up to date with `npm run build`.
|
||||
1. Bump the [package.json](/package.json#L3) and [package-lock.json](/package-lock.json#L3) version numbers and commit them.
|
||||
1. Ensure that the build is up to date with `npm run build`. It's also good to ensure you have the correct dependencies installed by running `npm install` before you build.
|
||||
1. Bump the [package.json](/package.json#L3) and [package-lock.json](/package-lock.json#L3) version numbers and commit them. I like to do this with `npm version {major,minor,patch} --no-git-tag-version`. This will bump the version numbers but let you manually commit and tag, yourself.
|
||||
1. Update documentation (including updated version numbers).
|
||||
1. Tag main with the new version number and create a GitHub release.
|
||||
1. Tag main with the new version number and create a GitHub release. Make sure you also force-create and force-push tags for minor and patch updates. For example, when creating v5.1.0 (a minor bump), you want to create (or update) `v5`, `v5.1`, and `v5.1.0`.
|
||||
|
||||
84
package-lock.json
generated
84
package-lock.json
generated
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "github-script",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
|
||||
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||
},
|
||||
"@actions/github": {
|
||||
"version": "4.0.0",
|
||||
@@ -1186,17 +1186,17 @@
|
||||
}
|
||||
},
|
||||
"@octokit/auth-token": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz",
|
||||
"integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==",
|
||||
"version": "2.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.3.tgz",
|
||||
"integrity": "sha512-fdGoOQ3kQJh+hrilc0Plg50xSfaCKOeYN9t6dpJKXN9BxhhfquL0OzoQXg3spLYymL5rm29uPeI3KEXRaZQ9zg==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/core": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.2.tgz",
|
||||
"integrity": "sha512-AInOFULmwOa7+NFi9F8DlDkm5qtZVmDQayi7TUgChE3yeIGPq0Y+6cAEXPexQ3Ea+uZy66hKEazR7DJyU+4wfw==",
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.1.tgz",
|
||||
"integrity": "sha512-XfFSDDwv6tclUenS0EmB6iA7u+4aOHBT1Lz4PtQNQQg3hBbNaR/+Uv5URU+egeIuuGAiMRiDyY92G4GBOWOqDA==",
|
||||
"requires": {
|
||||
"@octokit/auth-token": "^2.4.0",
|
||||
"@octokit/graphql": "^4.3.1",
|
||||
@@ -1207,19 +1207,19 @@
|
||||
}
|
||||
},
|
||||
"@octokit/endpoint": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz",
|
||||
"integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==",
|
||||
"version": "6.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.9.tgz",
|
||||
"integrity": "sha512-3VPLbcCuqji4IFTclNUtGdp9v7g+nspWdiCUbK3+iPMjJCZ6LEhn1ts626bWLOn0GiDb6j+uqGvPpqLnY7pBgw==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.0.0",
|
||||
"is-plain-object": "^4.0.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/graphql": {
|
||||
"version": "4.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.4.tgz",
|
||||
"integrity": "sha512-ITpZ+dQc0cXAW1FmDkHJJM+8Lb6anUnin0VB5hLBilnYVdLC0ICFU/KIvT7OXfW9S81DE3U4Vx2EypDG1OYaPA==",
|
||||
"version": "4.5.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.7.tgz",
|
||||
"integrity": "sha512-Gk0AR+DcwIK/lK/GX+OQ99UqtenQhcbrhHHfOYlrCQe17ADnX3EKAOKRsAZ9qZvpi5MuwWm/Nm+9aO2kTDSdyA==",
|
||||
"requires": {
|
||||
"@octokit/request": "^5.3.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
@@ -1227,41 +1227,41 @@
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-paginate-rest": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz",
|
||||
"integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==",
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.0.tgz",
|
||||
"integrity": "sha512-o+O8c1PqsC5++BHXfMZabRRsBIVb34tXPWyQLyp2IXq5MmkxdipS7TXM4Y9ldL1PzY9CTrCsn/lzFFJGM3oRRA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.2.0"
|
||||
"@octokit/types": "^5.5.0"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz",
|
||||
"integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==",
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.1.tgz",
|
||||
"integrity": "sha512-QyFr4Bv807Pt1DXZOC5a7L5aFdrwz71UHTYoHVajYV5hsqffWm8FUl9+O7nxRu5PDMtB/IKrhFqTmdBTK5cx+A==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.1.1",
|
||||
"@octokit/types": "^5.5.0",
|
||||
"deprecation": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"@octokit/request": {
|
||||
"version": "5.4.7",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz",
|
||||
"integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==",
|
||||
"version": "5.4.10",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.10.tgz",
|
||||
"integrity": "sha512-egA49HkqEORVGDZGav1mh+VD+7uLgOxtn5oODj6guJk0HCy+YBSYapFkSLFgeYj3Fr18ZULKGURkjyhkAChylw==",
|
||||
"requires": {
|
||||
"@octokit/endpoint": "^6.0.1",
|
||||
"@octokit/request-error": "^2.0.0",
|
||||
"@octokit/types": "^5.0.0",
|
||||
"deprecation": "^2.0.0",
|
||||
"is-plain-object": "^4.0.0",
|
||||
"node-fetch": "^2.3.0",
|
||||
"is-plain-object": "^5.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"once": "^1.4.0",
|
||||
"universal-user-agent": "^6.0.0"
|
||||
}
|
||||
},
|
||||
"@octokit/request-error": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz",
|
||||
"integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==",
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.3.tgz",
|
||||
"integrity": "sha512-GgD5z8Btm301i2zfvJLk/mkhvGCdjQ7wT8xF9ov5noQY8WbKZDH9cOBqXzoeKd1mLr1xH2FwbtGso135zGBgTA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.0.1",
|
||||
"deprecation": "^2.0.0",
|
||||
@@ -1269,9 +1269,9 @@
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.4.1.tgz",
|
||||
"integrity": "sha512-OlMlSySBJoJ6uozkr/i03nO5dlYQyE05vmQNZhAh9MyO4DPBP88QlwsDVLmVjIMFssvIZB6WO0ctIGMRG+xsJQ==",
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
|
||||
"integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
@@ -3523,9 +3523,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"is-plain-object": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz",
|
||||
"integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA=="
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||
},
|
||||
"is-potential-custom-element-name": {
|
||||
"version": "1.0.0",
|
||||
@@ -5470,9 +5470,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"node-int64": {
|
||||
"version": "0.4.0",
|
||||
|
||||
10
package.json
10
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "github-script",
|
||||
"description": "A GitHub action for executing a simple script",
|
||||
"version": "3.0.0",
|
||||
"version": "3.1.0",
|
||||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
@@ -35,12 +35,12 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.4",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@octokit/core": "^3.1.2",
|
||||
"@octokit/plugin-paginate-rest": "^2.3.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "^4.1.2"
|
||||
"@octokit/core": "^3.2.1",
|
||||
"@octokit/plugin-paginate-rest": "^2.6.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.10",
|
||||
|
||||
Reference in New Issue
Block a user