Compare commits

..

26 Commits

Author SHA1 Message Date
Jonathan Clem
47f7cf65b5 v3.1.0 2020-11-17 09:16:23 -05:00
Jonathan Clem
58579a2cbf Merge pull request #100 from actions/bump-octokit
Bump Octokit core, REST pagination, REST methdos
2020-11-17 09:15:55 -05:00
Jonathan Clem
8c2abf1707 Bump Octokit licenses 2020-11-17 09:14:13 -05:00
Jonathan Clem
ed05d35c66 Bump Octokit core, REST pagination, REST methdos 2020-11-17 09:13:01 -05:00
Jonathan Clem
bc192ff403 Merge pull request #99 from actions/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-11-17 09:11:56 -05:00
Jonathan Clem
5c195044a2 Update node-fetch cached license 2020-11-17 09:10:45 -05:00
dependabot[bot]
bdd2dafb12 Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-17 14:07:52 +00:00
Jonathan Clem
2d40ba5c82 Update development.md 2020-11-17 08:53:50 -05:00
Jonathan Clem
3c58ce3675 v3.0.2 2020-11-17 08:43:24 -05:00
Jonathan Clem
ff0a9e81a8 v3.0.1 2020-11-17 08:11:47 -05:00
Jonathan Clem
9d620e45a4 Merge pull request #98 from hfaulds/core-1.2.6
Bump @actions/core from 1.2.4 to 1.2.6 dependencies
2020-11-17 08:06:58 -05:00
Hayden Faulds
e5156a8b84 rebuild distribution 2020-11-17 11:19:50 +00:00
Hayden Faulds
b780942434 update licenses 2020-11-17 11:19:43 +00:00
Jonathan Clem
f035cea467 Merge pull request #95 from pradyunsg/patch-1
Move information about diffs to correct heading
2020-11-02 12:25:15 -05:00
Pradyun Gedam
6bd37e1a50 Move information about diffs to correct heading 2020-10-31 19:18:40 +05:30
dependabot[bot]
9124ee04c3 Bump @actions/core from 1.2.4 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-05 17:44:36 +00:00
Jonathan Clem
28e5ebafd7 Update README.md 2020-10-05 13:43:31 -04:00
Jonathan Clem
ce5d26b1ab Merge pull request #88 from clarkbw/patch-1
Add a GraphQL example to the README
2020-09-21 09:53:37 -04:00
Bryan Clark
91121b9cb3 Fixup typo 2020-09-17 12:58:40 -07:00
Bryan Clark
ac77fc9f3f Add a GraphQL example 2020-09-17 12:57:34 -07:00
Jonathan Clem
eb58336601 Merge pull request #86 from actions/fix-readme-args-example
Fix example function arguments in README
2020-09-01 09:44:23 -04:00
Jonathan Clem
af3c0bbd72 Fix example function arguments 2020-09-01 09:42:22 -04:00
Jonathan Clem
fdf4916d13 Merge pull request #84 from victoriadrake/patch-1
Clean up README
2020-08-27 16:20:53 -04:00
Victoria Drake
89e42e73d1 Clean up README
Remove text that seems to be repeated
2020-08-22 09:25:58 -04:00
Jonathan Clem
e2ddba4dfc Fix Integration/CI badges 2020-08-21 11:15:59 -04:00
Jonathan Clem
cf1dcb0bd5 Add nicer status badges and workflow names 2020-08-21 11:13:16 -04:00
19 changed files with 371 additions and 515 deletions

View File

@@ -1,3 +1,5 @@
name: CI
on: on:
push: {branches: main} push: {branches: main}
pull_request: {branches: main} pull_request: {branches: main}

View File

@@ -1,3 +1,5 @@
name: Integration
on: on:
push: {branches: main} push: {branches: main}

View File

@@ -1,30 +1,20 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.2.4 version: 1.2.6
type: npm type: npm
summary: Actions core lib 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 license: mit
licenses: licenses:
- sources: Auto-generated MIT license text - sources: LICENSE.md
text: | text: |-
MIT License The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy Copyright 2019 GitHub
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 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:
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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.
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: [] notices: []

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/auth-token" name: "@octokit/auth-token"
version: 2.4.2 version: 2.4.3
type: npm type: npm
summary: GitHub API token authentication for browsers and Node.js summary: GitHub API token authentication for browsers and Node.js
homepage: https://github.com/octokit/auth-token.js#readme homepage: https://github.com/octokit/auth-token.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/core" name: "@octokit/core"
version: 3.1.2 version: 3.2.1
type: npm type: npm
summary: Extendable client for GitHub's REST & GraphQL APIs summary: Extendable client for GitHub's REST & GraphQL APIs
homepage: https://github.com/octokit/core.js#readme homepage: https://github.com/octokit/core.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/endpoint" name: "@octokit/endpoint"
version: 6.0.5 version: 6.0.9
type: npm type: npm
summary: Turns REST API endpoints into generic request options summary: Turns REST API endpoints into generic request options
homepage: https://github.com/octokit/endpoint.js#readme homepage: https://github.com/octokit/endpoint.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/graphql" name: "@octokit/graphql"
version: 4.5.4 version: 4.5.7
type: npm type: npm
summary: GitHub GraphQL API client for browsers and Node summary: GitHub GraphQL API client for browsers and Node
homepage: https://github.com/octokit/graphql.js#readme homepage: https://github.com/octokit/graphql.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/plugin-paginate-rest" name: "@octokit/plugin-paginate-rest"
version: 2.3.0 version: 2.6.0
type: npm type: npm
summary: Octokit plugin to paginate REST API endpoint responses summary: Octokit plugin to paginate REST API endpoint responses
homepage: https://github.com/octokit/plugin-paginate-rest.js#readme homepage: https://github.com/octokit/plugin-paginate-rest.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/plugin-rest-endpoint-methods" name: "@octokit/plugin-rest-endpoint-methods"
version: 4.1.2 version: 4.2.1
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
homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme homepage: https://github.com/octokit/plugin-rest-endpoint-methods.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/request-error" name: "@octokit/request-error"
version: 2.0.2 version: 2.0.3
type: npm type: npm
summary: Error class for Octokit request errors summary: Error class for Octokit request errors
homepage: https://github.com/octokit/request-error.js#readme homepage: https://github.com/octokit/request-error.js#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/request" name: "@octokit/request"
version: 5.4.7 version: 5.4.10
type: npm type: npm
summary: Send parameterized requests to GitHubs APIs with sensible defaults in browsers summary: Send parameterized requests to GitHubs APIs with sensible defaults in browsers
and Node and Node

View File

@@ -1,6 +1,6 @@
--- ---
name: "@octokit/types" name: "@octokit/types"
version: 5.4.1 version: 5.5.0
type: npm type: npm
summary: Shared TypeScript definitions for Octokit projects summary: Shared TypeScript definitions for Octokit projects
homepage: https://github.com/octokit/types.ts#readme homepage: https://github.com/octokit/types.ts#readme

View File

@@ -1,6 +1,6 @@
--- ---
name: is-plain-object name: is-plain-object
version: 4.1.1 version: 5.0.0
type: npm type: npm
summary: Returns true if an object was created by the `Object` constructor, or Object.create(null). summary: Returns true if an object was created by the `Object` constructor, or Object.create(null).
homepage: https://github.com/jonschlinkert/is-plain-object homepage: https://github.com/jonschlinkert/is-plain-object

View File

@@ -1,6 +1,6 @@
--- ---
name: node-fetch name: node-fetch
version: 2.6.0 version: 2.6.1
type: npm type: npm
summary: A light-weight module that brings window.fetch to node.js summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch homepage: https://github.com/bitinn/node-fetch
@@ -42,6 +42,10 @@ licenses:
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch [codecov-url]: https://codecov.io/gh/bitinn/node-fetch
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch [install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
[install-size-url]: https://packagephobia.now.sh/result?p=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/ [whatwg-fetch]: https://fetch.spec.whatwg.org/
[response-init]: https://fetch.spec.whatwg.org/#responseinit [response-init]: https://fetch.spec.whatwg.org/#responseinit
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams [node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams

237
README.md
View File

@@ -1,4 +1,8 @@
# github-script ![.github/workflows/integration.yml](https://github.com/actions/github-script/workflows/.github/workflows/integration.yml/badge.svg?event=push) ![.github/workflows/ci.yml](https://github.com/actions/github-script/workflows/.github/workflows/ci.yml/badge.svg?event=push) ![.github/workflows/licensed.yml](https://github.com/actions/github-script/workflows/Licensed/badge.svg?event=push) # actions/github-script
[![.github/workflows/integration.yml](https://github.com/actions/github-script/workflows/Integration/badge.svg?event=push&branch=main)](https://github.com/actions/github-script/actions?query=workflow%3AIntegration+branch%3Amain+event%3Apush)
[![.github/workflows/ci.yml](https://github.com/actions/github-script/workflows/CI/badge.svg?event=push&branch=main)](https://github.com/actions/github-script/actions?query=workflow%3ACI+branch%3Amain+event%3Apush)
[![.github/workflows/licensed.yml](https://github.com/actions/github-script/workflows/Licensed/badge.svg?event=push&branch=main)](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 This action makes it easy to quickly write a script in your workflow that
uses the GitHub API and the workflow run context. 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: arguments will be provided:
- `github` A pre-authenticated - `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 - `context` An object containing the [context of the workflow
run](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts) 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 - `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 This will print the full diff object in the screen; `result.data` will
contain the actual diff text. 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 You can use the `github.graphql` object to run custom GraphQL queries against the GitHub API.
use a separate JavaScript module in your repository like so:
```yaml ```yaml
on: push
jobs: jobs:
echo-input: list-packages:
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:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/github-script@v3 - uses: actions/github-script@v3
with: with:
github-token: ${{secrets.GITHUB_TOKEN}} github-token: ${{secrets.GITHUB_TOKEN}}
script: | script: |
github.issues.createComment({ const query = `query($owner:String!, $name:String!) {
issue_number: context.issue.number, repository(owner:$owner, name:$name){
owner: context.repo.owner, issues(first:100, labels: [$label]) {
repo: context.repo.repo, nodes {
body: '👋 Thanks for reporting!' id
}) }
``` }
### 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 variables = {
owner: context.repo.owner,
name: context.repo.repo,
label: 'wontfix'
} }
const result = await github.graphql(query, variables)
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)
console.log(result) 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 ### Run a separate file
If you don't want to inline your entire script that you want to run, you can 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})) 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: And then export a function from your module:
```javascript ```javascript
module.exports = (github, context) => { module.exports = ({github, context}) => {
return context.payload.client_payload.value return context.payload.client_payload.value
} }
``` ```

489
dist/index.js vendored
View File

@@ -211,11 +211,7 @@ const Endpoints = {
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"] unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
}, },
apps: { apps: {
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", { addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
checkToken: ["POST /applications/{client_id}/token"], checkToken: ["POST /applications/{client_id}/token"],
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", { createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
mediaType: { mediaType: {
@@ -223,81 +219,29 @@ const Endpoints = {
} }
}], }],
createFromManifest: ["POST /app-manifests/{code}/conversions"], createFromManifest: ["POST /app-manifests/{code}/conversions"],
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens", { createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"],
mediaType: {
previews: ["machine-man"]
}
}],
deleteAuthorization: ["DELETE /applications/{client_id}/grant"], deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
deleteInstallation: ["DELETE /app/installations/{installation_id}", { deleteInstallation: ["DELETE /app/installations/{installation_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
deleteToken: ["DELETE /applications/{client_id}/token"], deleteToken: ["DELETE /applications/{client_id}/token"],
getAuthenticated: ["GET /app", { getAuthenticated: ["GET /app"],
mediaType: { getBySlug: ["GET /apps/{app_slug}"],
previews: ["machine-man"] getInstallation: ["GET /app/installations/{installation_id}"],
} getOrgInstallation: ["GET /orgs/{org}/installation"],
}], getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
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"]
}
}],
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"], getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"], getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
getUserInstallation: ["GET /users/{username}/installation", { getUserInstallation: ["GET /users/{username}/installation"],
mediaType: {
previews: ["machine-man"]
}
}],
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"], listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"], listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", { listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
mediaType: { listInstallations: ["GET /app/installations"],
previews: ["machine-man"] listInstallationsForAuthenticatedUser: ["GET /user/installations"],
}
}],
listInstallations: ["GET /app/installations", {
mediaType: {
previews: ["machine-man"]
}
}],
listInstallationsForAuthenticatedUser: ["GET /user/installations", {
mediaType: {
previews: ["machine-man"]
}
}],
listPlans: ["GET /marketplace_listing/plans"], listPlans: ["GET /marketplace_listing/plans"],
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"], listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
listReposAccessibleToInstallation: ["GET /installation/repositories", { listReposAccessibleToInstallation: ["GET /installation/repositories"],
mediaType: {
previews: ["machine-man"]
}
}],
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"], listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"], listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", { removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
mediaType: {
previews: ["machine-man"]
}
}],
resetToken: ["PATCH /applications/{client_id}/token"], resetToken: ["PATCH /applications/{client_id}/token"],
revokeInstallationAccessToken: ["DELETE /installation/token"], revokeInstallationAccessToken: ["DELETE /installation/token"],
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"], suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
@@ -369,8 +313,15 @@ const Endpoints = {
}] }]
}, },
codeScanning: { codeScanning: {
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"], getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"] 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: { codesOfConduct: {
getAllCodesOfConduct: ["GET /codes_of_conduct", { getAllCodesOfConduct: ["GET /codes_of_conduct", {
@@ -612,11 +563,7 @@ const Endpoints = {
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
list: ["GET /organizations"], list: ["GET /organizations"],
listAppInstallations: ["GET /orgs/{org}/installations", { listAppInstallations: ["GET /orgs/{org}/installations"],
mediaType: {
previews: ["machine-man"]
}
}],
listBlockedUsers: ["GET /orgs/{org}/blocks"], listBlockedUsers: ["GET /orgs/{org}/blocks"],
listForAuthenticatedUser: ["GET /user/orgs"], listForAuthenticatedUser: ["GET /user/orgs"],
listForUser: ["GET /users/{username}/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) { function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {}; const newMethods = {};
@@ -1428,6 +1375,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = __webpack_require__(351); 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 os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622)); const path = __importStar(__webpack_require__(622));
/** /**
@@ -1454,9 +1403,17 @@ var ExitCode;
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
function exportVariable(name, val) { function exportVariable(name, val) {
const convertedVal = command_1.toCommandValue(val); const convertedVal = utils_1.toCommandValue(val);
process.env[name] = convertedVal; 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; exports.exportVariable = exportVariable;
/** /**
@@ -1472,7 +1429,13 @@ exports.setSecret = setSecret;
* @param inputPath * @param inputPath
*/ */
function addPath(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']}`; process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
} }
exports.addPath = addPath; exports.addPath = addPath;
@@ -1642,7 +1605,7 @@ exports.getState = getState;
Object.defineProperty(exports, '__esModule', { value: true }); 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 * 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; let url = options.url;
return { return {
[Symbol.asyncIterator]: () => ({ [Symbol.asyncIterator]: () => ({
next() { async next() {
if (!url) { if (!url) return {
return Promise.resolve({ done: true
done: true };
}); const response = await requestMethod({
}
return requestMethod({
method, method,
url, url,
headers 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 octokit Octokit instance
* @param options Options passed to Octokit constructor * @param options Options passed to Octokit constructor
@@ -1766,6 +1730,7 @@ function paginateRest(octokit) {
} }
paginateRest.VERSION = VERSION; paginateRest.VERSION = VERSION;
exports.composePaginateRest = composePaginateRest;
exports.paginateRest = paginateRest; exports.paginateRest = paginateRest;
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
@@ -2112,18 +2077,18 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
var endpoint = __webpack_require__(440); var endpoint = __webpack_require__(440);
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
var isPlainObject = _interopDefault(__webpack_require__(840)); var isPlainObject = __webpack_require__(287);
var nodeFetch = _interopDefault(__webpack_require__(467)); var nodeFetch = _interopDefault(__webpack_require__(467));
var requestError = __webpack_require__(537); var requestError = __webpack_require__(537);
const VERSION = "5.4.7"; const VERSION = "5.4.10";
function getBufferResponse(response) { function getBufferResponse(response) {
return response.arrayBuffer(); return response.arrayBuffer();
} }
function fetchWrapper(requestOptions) { 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); requestOptions.body = JSON.stringify(requestOptions.body);
} }
@@ -2254,6 +2219,78 @@ exports.request = request;
//# sourceMappingURL=index.js.map //# 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: /***/ 294:
@@ -2335,6 +2372,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(__webpack_require__(87)); const os = __importStar(__webpack_require__(87));
const utils_1 = __webpack_require__(278);
/** /**
* Commands * Commands
* *
@@ -2388,28 +2426,14 @@ class Command {
return cmdStr; 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) { function escapeData(s) {
return toCommandValue(s) return utils_1.toCommandValue(s)
.replace(/%/g, '%25') .replace(/%/g, '%25')
.replace(/\r/g, '%0D') .replace(/\r/g, '%0D')
.replace(/\n/g, '%0A'); .replace(/\n/g, '%0A');
} }
function escapeProperty(s) { function escapeProperty(s) {
return toCommandValue(s) return utils_1.toCommandValue(s)
.replace(/%/g, '%25') .replace(/%/g, '%25')
.replace(/\r/g, '%0D') .replace(/\r/g, '%0D')
.replace(/\n/g, '%0A') .replace(/\n/g, '%0A')
@@ -2808,9 +2832,7 @@ exports.getOctokit = getOctokit;
Object.defineProperty(exports, '__esModule', { value: true }); Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var isPlainObject = __webpack_require__(287);
var isPlainObject = _interopDefault(__webpack_require__(840));
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
function lowercaseKeys(object) { function lowercaseKeys(object) {
@@ -2827,7 +2849,7 @@ function lowercaseKeys(object) {
function mergeDeep(defaults, options) { function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults); const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => { Object.keys(options).forEach(key => {
if (isPlainObject(options[key])) { if (isPlainObject.isPlainObject(options[key])) {
if (!(key in defaults)) Object.assign(result, { if (!(key in defaults)) Object.assign(result, {
[key]: options[key] [key]: options[key]
});else result[key] = mergeDeep(defaults[key], options[key]); });else result[key] = mergeDeep(defaults[key], options[key]);
@@ -2840,6 +2862,16 @@ function mergeDeep(defaults, options) {
return result; return result;
} }
function removeUndefinedProperties(obj) {
for (const key in obj) {
if (obj[key] === undefined) {
delete obj[key];
}
}
return obj;
}
function merge(defaults, route, options) { function merge(defaults, route, options) {
if (typeof route === "string") { if (typeof route === "string") {
let [method, url] = route.split(" "); let [method, url] = route.split(" ");
@@ -2854,7 +2886,10 @@ function merge(defaults, route, options) {
} // lowercase header names before merging with defaults to avoid duplicates } // 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 const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) { if (defaults && defaults.mediaType.previews.length) {
@@ -3076,7 +3111,7 @@ function parse(options) {
// https://fetch.spec.whatwg.org/#methods // https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible 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 headers = Object.assign({}, options.headers);
let body; let body;
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later 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 omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
const remainingParameters = omit(parameters, omittedParameters); 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) { if (options.mediaType.format) {
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw // 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(","); 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. 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. // So we use RequestParameters and add method as additional required property.
@@ -3724,6 +3759,12 @@ function convertBody(buffer, headers) {
// html4 // html4
if (!res && str) { if (!res && str) {
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(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) { if (res) {
res = /charset=(.*)/i.exec(res.pop()); res = /charset=(.*)/i.exec(res.pop());
@@ -4731,7 +4772,7 @@ function fetch(url, opts) {
// HTTP fetch step 5.5 // HTTP fetch step 5.5
switch (request.redirect) { switch (request.redirect) {
case 'error': 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(); finalize();
return; return;
case 'manual': case 'manual':
@@ -4770,7 +4811,8 @@ function fetch(url, opts) {
method: request.method, method: request.method,
body: request.body, body: request.body,
signal: request.signal, signal: request.signal,
timeout: request.timeout timeout: request.timeout,
size: request.size
}; };
// HTTP-redirect fetch step 9 // HTTP-redirect fetch step 9
@@ -5058,7 +5100,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
var request = __webpack_require__(234); var request = __webpack_require__(234);
var universalUserAgent = __webpack_require__(429); var universalUserAgent = __webpack_require__(429);
const VERSION = "4.5.4"; const VERSION = "4.5.7";
class GraphqlError extends Error { class GraphqlError extends Error {
constructor(request, response) { constructor(request, response) {
@@ -5081,13 +5123,18 @@ class GraphqlError extends Error {
} }
const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"]; const NON_VARIABLE_OPTIONS = ["method", "baseUrl", "url", "headers", "request", "query", "mediaType"];
const GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
function graphql(request, query, options) { 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 query
}, options) : options = query; }, options) : query;
const requestOptions = Object.keys(options).reduce((result, key) => { const requestOptions = Object.keys(parsedOptions).reduce((result, key) => {
if (NON_VARIABLE_OPTIONS.includes(key)) { if (NON_VARIABLE_OPTIONS.includes(key)) {
result[key] = options[key]; result[key] = parsedOptions[key];
return result; return result;
} }
@@ -5095,9 +5142,17 @@ function graphql(request, query, options) {
result.variables = {}; result.variables = {};
} }
result.variables[key] = options[key]; result.variables[key] = parsedOptions[key];
return result; 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 => { return request(requestOptions).then(response => {
if (response.data.errors) { if (response.data.errors) {
const headers = {}; const headers = {};
@@ -5254,6 +5309,42 @@ module.exports.Singular = Hook.Singular
module.exports.Collection = Hook.Collection 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: /***/ 720:
@@ -5353,56 +5444,43 @@ var request = __webpack_require__(234);
var graphql = __webpack_require__(668); var graphql = __webpack_require__(668);
var authToken = __webpack_require__(334); var authToken = __webpack_require__(334);
function _defineProperty(obj, key, value) { function _objectWithoutPropertiesLoose(source, excluded) {
if (key in obj) { if (source == null) return {};
Object.defineProperty(obj, key, { var target = {};
value: value, var sourceKeys = Object.keys(source);
enumerable: true, var key, i;
configurable: true,
writable: true for (i = 0; i < sourceKeys.length; i++) {
}); key = sourceKeys[i];
} else { if (excluded.indexOf(key) >= 0) continue;
obj[key] = value; target[key] = source[key];
} }
return obj; return target;
} }
function ownKeys(object, enumerableOnly) { function _objectWithoutProperties(source, excluded) {
var keys = Object.keys(object); if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) { if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object); var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys; for (i = 0; i < sourceSymbolKeys.length; i++) {
} key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
function _objectSpread2(target) { if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
for (var i = 1; i < arguments.length; i++) { target[key] = source[key];
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));
});
} }
} }
return target; return target;
} }
const VERSION = "3.1.2"; const VERSION = "3.2.1";
class Octokit { class Octokit {
constructor(options = {}) { constructor(options = {}) {
@@ -5434,9 +5512,7 @@ class Octokit {
} }
this.request = request.request.defaults(requestDefaults); this.request = request.request.defaults(requestDefaults);
this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, { this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api")
}));
this.log = Object.assign({ this.log = Object.assign({
debug: () => {}, debug: () => {},
info: () => {}, info: () => {},
@@ -5444,7 +5520,7 @@ class Octokit {
error: console.error.bind(console) error: console.error.bind(console)
}, options.log); }, options.log);
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance 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. // (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. // (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`. // TODO: type `options.auth` based on `options.authStrategy`.
@@ -5463,8 +5539,21 @@ class Octokit {
this.auth = auth; this.auth = auth;
} }
} else { } else {
const auth = options.authStrategy(Object.assign({ const {
request: this.request 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 ¯\_(ツ)_/¯ }, options.auth)); // @ts-ignore ¯\_(ツ)_/¯
hook.wrap("request", auth.hook); hook.wrap("request", auth.hook);
@@ -5552,50 +5641,6 @@ function removeHook (state, name, method) {
module.exports = require("url"); 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: /***/ 875:

View File

@@ -22,7 +22,7 @@ well.
Releases are done manually, for now: Releases are done manually, for now:
1. Ensure that the build is up to date with `npm run build`. 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. 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. 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
View File

@@ -1,13 +1,13 @@
{ {
"name": "github-script", "name": "github-script",
"version": "3.0.0", "version": "3.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.2.4", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
}, },
"@actions/github": { "@actions/github": {
"version": "4.0.0", "version": "4.0.0",
@@ -1186,17 +1186,17 @@
} }
}, },
"@octokit/auth-token": { "@octokit/auth-token": {
"version": "2.4.2", "version": "2.4.3",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.3.tgz",
"integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==", "integrity": "sha512-fdGoOQ3kQJh+hrilc0Plg50xSfaCKOeYN9t6dpJKXN9BxhhfquL0OzoQXg3spLYymL5rm29uPeI3KEXRaZQ9zg==",
"requires": { "requires": {
"@octokit/types": "^5.0.0" "@octokit/types": "^5.0.0"
} }
}, },
"@octokit/core": { "@octokit/core": {
"version": "3.1.2", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.1.tgz",
"integrity": "sha512-AInOFULmwOa7+NFi9F8DlDkm5qtZVmDQayi7TUgChE3yeIGPq0Y+6cAEXPexQ3Ea+uZy66hKEazR7DJyU+4wfw==", "integrity": "sha512-XfFSDDwv6tclUenS0EmB6iA7u+4aOHBT1Lz4PtQNQQg3hBbNaR/+Uv5URU+egeIuuGAiMRiDyY92G4GBOWOqDA==",
"requires": { "requires": {
"@octokit/auth-token": "^2.4.0", "@octokit/auth-token": "^2.4.0",
"@octokit/graphql": "^4.3.1", "@octokit/graphql": "^4.3.1",
@@ -1207,19 +1207,19 @@
} }
}, },
"@octokit/endpoint": { "@octokit/endpoint": {
"version": "6.0.5", "version": "6.0.9",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz", "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.9.tgz",
"integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==", "integrity": "sha512-3VPLbcCuqji4IFTclNUtGdp9v7g+nspWdiCUbK3+iPMjJCZ6LEhn1ts626bWLOn0GiDb6j+uqGvPpqLnY7pBgw==",
"requires": { "requires": {
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
"is-plain-object": "^4.0.0", "is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/graphql": { "@octokit/graphql": {
"version": "4.5.4", "version": "4.5.7",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.4.tgz", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.7.tgz",
"integrity": "sha512-ITpZ+dQc0cXAW1FmDkHJJM+8Lb6anUnin0VB5hLBilnYVdLC0ICFU/KIvT7OXfW9S81DE3U4Vx2EypDG1OYaPA==", "integrity": "sha512-Gk0AR+DcwIK/lK/GX+OQ99UqtenQhcbrhHHfOYlrCQe17ADnX3EKAOKRsAZ9qZvpi5MuwWm/Nm+9aO2kTDSdyA==",
"requires": { "requires": {
"@octokit/request": "^5.3.0", "@octokit/request": "^5.3.0",
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
@@ -1227,41 +1227,41 @@
} }
}, },
"@octokit/plugin-paginate-rest": { "@octokit/plugin-paginate-rest": {
"version": "2.3.0", "version": "2.6.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.0.tgz",
"integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==", "integrity": "sha512-o+O8c1PqsC5++BHXfMZabRRsBIVb34tXPWyQLyp2IXq5MmkxdipS7TXM4Y9ldL1PzY9CTrCsn/lzFFJGM3oRRA==",
"requires": { "requires": {
"@octokit/types": "^5.2.0" "@octokit/types": "^5.5.0"
} }
}, },
"@octokit/plugin-rest-endpoint-methods": { "@octokit/plugin-rest-endpoint-methods": {
"version": "4.1.2", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.1.tgz",
"integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==", "integrity": "sha512-QyFr4Bv807Pt1DXZOC5a7L5aFdrwz71UHTYoHVajYV5hsqffWm8FUl9+O7nxRu5PDMtB/IKrhFqTmdBTK5cx+A==",
"requires": { "requires": {
"@octokit/types": "^5.1.1", "@octokit/types": "^5.5.0",
"deprecation": "^2.3.1" "deprecation": "^2.3.1"
} }
}, },
"@octokit/request": { "@octokit/request": {
"version": "5.4.7", "version": "5.4.10",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz", "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.10.tgz",
"integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==", "integrity": "sha512-egA49HkqEORVGDZGav1mh+VD+7uLgOxtn5oODj6guJk0HCy+YBSYapFkSLFgeYj3Fr18ZULKGURkjyhkAChylw==",
"requires": { "requires": {
"@octokit/endpoint": "^6.0.1", "@octokit/endpoint": "^6.0.1",
"@octokit/request-error": "^2.0.0", "@octokit/request-error": "^2.0.0",
"@octokit/types": "^5.0.0", "@octokit/types": "^5.0.0",
"deprecation": "^2.0.0", "deprecation": "^2.0.0",
"is-plain-object": "^4.0.0", "is-plain-object": "^5.0.0",
"node-fetch": "^2.3.0", "node-fetch": "^2.6.1",
"once": "^1.4.0", "once": "^1.4.0",
"universal-user-agent": "^6.0.0" "universal-user-agent": "^6.0.0"
} }
}, },
"@octokit/request-error": { "@octokit/request-error": {
"version": "2.0.2", "version": "2.0.3",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz", "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.3.tgz",
"integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==", "integrity": "sha512-GgD5z8Btm301i2zfvJLk/mkhvGCdjQ7wT8xF9ov5noQY8WbKZDH9cOBqXzoeKd1mLr1xH2FwbtGso135zGBgTA==",
"requires": { "requires": {
"@octokit/types": "^5.0.1", "@octokit/types": "^5.0.1",
"deprecation": "^2.0.0", "deprecation": "^2.0.0",
@@ -1269,9 +1269,9 @@
} }
}, },
"@octokit/types": { "@octokit/types": {
"version": "5.4.1", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.4.1.tgz", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
"integrity": "sha512-OlMlSySBJoJ6uozkr/i03nO5dlYQyE05vmQNZhAh9MyO4DPBP88QlwsDVLmVjIMFssvIZB6WO0ctIGMRG+xsJQ==", "integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
"requires": { "requires": {
"@types/node": ">= 8" "@types/node": ">= 8"
} }
@@ -3523,9 +3523,9 @@
"dev": true "dev": true
}, },
"is-plain-object": { "is-plain-object": {
"version": "4.1.1", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
"integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==" "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
}, },
"is-potential-custom-element-name": { "is-potential-custom-element-name": {
"version": "1.0.0", "version": "1.0.0",
@@ -5470,9 +5470,9 @@
"dev": true "dev": true
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.0", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
}, },
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",

View File

@@ -1,7 +1,7 @@
{ {
"name": "github-script", "name": "github-script",
"description": "A GitHub action for executing a simple script", "description": "A GitHub action for executing a simple script",
"version": "3.0.0", "version": "3.1.0",
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"main": "dist/index.js", "main": "dist/index.js",
@@ -35,12 +35,12 @@
} }
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.2.4", "@actions/core": "^1.2.6",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@octokit/core": "^3.1.2", "@octokit/core": "^3.2.1",
"@octokit/plugin-paginate-rest": "^2.3.0", "@octokit/plugin-paginate-rest": "^2.6.0",
"@octokit/plugin-rest-endpoint-methods": "^4.1.2" "@octokit/plugin-rest-endpoint-methods": "4.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.10", "@types/jest": "^26.0.10",