mirror of
https://github.com/actions/github-script.git
synced 2026-10-15 20:06:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4aed96e0ba | ||
|
|
e7d3d7ecb7 | ||
|
|
44b873bc97 | ||
|
|
b92989f423 | ||
|
|
5e49adabf5 | ||
|
|
4db7989ab1 | ||
|
|
a4a34d1dea | ||
|
|
3f9262325d | ||
|
|
07ecbc5ac0 | ||
|
|
a656f437f9 | ||
|
|
83107c8695 | ||
|
|
603dfa3ce2 | ||
|
|
62c8044fd6 | ||
|
|
c19d6ba8b3 | ||
|
|
1ba1e95cf2 | ||
|
|
b507739f17 | ||
|
|
95130f1202 | ||
|
|
82b33c82ef | ||
|
|
53cd48b63b | ||
|
|
6e5ee1dc1c | ||
|
|
fa718ed671 | ||
|
|
4789b35ac3 | ||
|
|
89e3c40f24 | ||
|
|
1b10125da5 | ||
|
|
9b7fae11e2 | ||
|
|
c7971c2fc0 | ||
|
|
7ec2818723 | ||
|
|
287e10e610 | ||
|
|
b2c461f3a2 |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
.licenses/** -diff linguist-generated=true
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
on:
|
on:
|
||||||
push: {branches: master}
|
push: {branches: main}
|
||||||
pull_request: {branches: master}
|
pull_request: {branches: main}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
on:
|
on:
|
||||||
push: {branches: master}
|
push: {branches: main}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
integration:
|
integration:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: output-set
|
- id: output-set
|
||||||
uses: actions/github-script@master
|
uses: actions/github-script@main
|
||||||
with:
|
with:
|
||||||
script: return core.getInput('input-value')
|
script: return core.getInput('input-value')
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Licensed
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {branches: main}
|
||||||
|
pull_request: {branches: main}
|
||||||
|
repository_dispatch:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Check licenses
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
|
||||||
|
restore-keys: ${{runner.os}}-npm-
|
||||||
|
- run: npm ci
|
||||||
|
- name: Install licensed
|
||||||
|
run: |-
|
||||||
|
cd $RUNNER_TEMP
|
||||||
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.9.2/licensed-2.9.2-linux-x64.tar.gz
|
||||||
|
sudo tar -xzf licensed.tar.gz
|
||||||
|
sudo mv licensed /usr/local/bin/licensed
|
||||||
|
- run: licensed status
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: main
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pull-request-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
// Get the existing comments.
|
||||||
|
const {data: comments} = await github.issues.listComments({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.payload.number,
|
||||||
|
})
|
||||||
|
|
||||||
|
// Find any comment already made by the bot.
|
||||||
|
const botComment = comments.find(comment => comment.user.id === 41898282)
|
||||||
|
const commentBody = "Hello from actions/github-script! (${{ github.sha }})"
|
||||||
|
|
||||||
|
if (botComment) {
|
||||||
|
await github.issues.updateComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
comment_id: botComment.id,
|
||||||
|
body: commentBody
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
await github.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.payload.number,
|
||||||
|
body: commentBody
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
sources:
|
||||||
|
npm: true
|
||||||
|
|
||||||
|
allowed:
|
||||||
|
- apache-2.0
|
||||||
|
- bsd-2-clause
|
||||||
|
- bsd-3-clause
|
||||||
|
- isc
|
||||||
|
- mit
|
||||||
|
- cc0-1.0
|
||||||
|
- unlicense
|
||||||
|
|
||||||
|
reviewed:
|
||||||
|
npm:
|
||||||
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
Generated
BIN
Binary file not shown.
@@ -10,8 +10,9 @@ arguments will be provided:
|
|||||||
- `github` A pre-authenticated
|
- `github` A pre-authenticated
|
||||||
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
[octokit/rest.js](https://github.com/octokit/rest.js) client
|
||||||
- `context` An object containing the [context of the workflow
|
- `context` An object containing the [context of the workflow
|
||||||
run](https://github.com/actions/toolkit/tree/master/packages/github)
|
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/master/packages/core) package
|
- `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
|
Since the `script` is just a function body, these values will already be
|
||||||
defined, so you don't have to (see examples below).
|
defined, so you don't have to (see examples below).
|
||||||
@@ -32,7 +33,7 @@ The return value of the script will be in the step's outputs under the
|
|||||||
"result" key.
|
"result" key.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
id: set-result
|
id: set-result
|
||||||
with:
|
with:
|
||||||
script: return "Hello!"
|
script: return "Hello!"
|
||||||
@@ -51,7 +52,7 @@ output of a github-script step. For some workflows, string encoding is preferred
|
|||||||
`result-encoding` input:
|
`result-encoding` input:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
id: my-script
|
id: my-script
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
@@ -77,7 +78,7 @@ jobs:
|
|||||||
comment:
|
comment:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -100,7 +101,7 @@ jobs:
|
|||||||
apply-label:
|
apply-label:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -121,7 +122,7 @@ jobs:
|
|||||||
welcome:
|
welcome:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -165,7 +166,7 @@ jobs:
|
|||||||
diff:
|
diff:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -174,6 +175,10 @@ jobs:
|
|||||||
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
|
This will print the full diff object in the screen; `result.data` will
|
||||||
contain the actual diff text.
|
contain the actual diff text.
|
||||||
|
|
||||||
@@ -189,19 +194,20 @@ jobs:
|
|||||||
echo-input:
|
echo-input:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: @actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: @actions/github-script@v1
|
- uses: actions/github-script@v2
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const path = require('path')
|
const script = require(`${process.env.GITHUB_WORKSPACE}/path/to/script.js`)
|
||||||
const scriptPath = path.resolve('./path/to/script.js')
|
console.log(script({github, context}))
|
||||||
console.log(require(scriptPath)({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:
|
And then export a function from your module:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
module.exports = ({context}) => {
|
module.exports = (github, context) => {
|
||||||
return context.payload.client_payload.value
|
return context.payload.client_payload.value
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
Vendored
+4555
-17312
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -25,4 +25,4 @@ 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`.
|
||||||
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.
|
||||||
1. Update documentation (including updated version numbers).
|
1. Update documentation (including updated version numbers).
|
||||||
1. Tag master with the new version number and create a GitHub release.
|
1. Tag main with the new version number and create a GitHub release.
|
||||||
Generated
+84
-124
@@ -1,22 +1,42 @@
|
|||||||
{
|
{
|
||||||
"name": "github-script",
|
"name": "github-script",
|
||||||
"version": "1.0.0",
|
"version": "2.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.4",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
|
||||||
"integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg=="
|
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
|
||||||
|
"requires": {
|
||||||
|
"@actions/http-client": "^2.0.1",
|
||||||
|
"uuid": "^8.3.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/http-client": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==",
|
||||||
|
"requires": {
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"@actions/github": {
|
"@actions/github": {
|
||||||
"version": "2.2.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/github/-/github-3.0.0.tgz",
|
||||||
"integrity": "sha512-9UAZqn8ywdR70n3GwVle4N8ALosQs4z50N7XMXrSTUVOmVpaBC5kE3TRTT7qQdi3OaQV24mjGuJZsHUmhD+ZXw==",
|
"integrity": "sha512-zSYo0Pzh/AZt0DCBjCUhd9lNBECbbWnPqq5L32DZDTuEhjGJM8VSgOpKSol9climaJxhPJQhu+vUZIZuQi4Z1w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^1.0.3",
|
"@actions/http-client": "^1.0.3",
|
||||||
"@octokit/graphql": "^4.3.1",
|
"@octokit/core": "^2.5.1",
|
||||||
"@octokit/rest": "^16.43.1"
|
"@octokit/plugin-paginate-rest": "^2.2.0",
|
||||||
|
"@octokit/plugin-rest-endpoint-methods": "^3.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/http-client": {
|
"@actions/http-client": {
|
||||||
@@ -27,6 +47,11 @@
|
|||||||
"tunnel": "0.0.6"
|
"tunnel": "0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@actions/io": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg=="
|
||||||
|
},
|
||||||
"@babel/code-frame": {
|
"@babel/code-frame": {
|
||||||
"version": "7.5.5",
|
"version": "7.5.5",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
|
||||||
@@ -788,63 +813,71 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/auth-token": {
|
"@octokit/auth-token": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.1.tgz",
|
||||||
"integrity": "sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg==",
|
"integrity": "sha512-NB81O5h39KfHYGtgfWr2booRxp2bWOJoqbWwbyUg2hw6h35ArWYlAST5B3XwAkbdcx13yt84hFXyFP5X0QToWA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^2.0.0"
|
"@octokit/types": "^4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@octokit/core": {
|
||||||
|
"version": "2.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-2.5.3.tgz",
|
||||||
|
"integrity": "sha512-23AHK9xBW0v79Ck8h5U+5iA4MW7aosqv+Yr6uZXolVGNzzHwryNH5wM386/6+etiKUTwLFZTqyMU9oQpIBZcFA==",
|
||||||
|
"requires": {
|
||||||
|
"@octokit/auth-token": "^2.4.0",
|
||||||
|
"@octokit/graphql": "^4.3.1",
|
||||||
|
"@octokit/request": "^5.4.0",
|
||||||
|
"@octokit/types": "^4.0.1",
|
||||||
|
"before-after-hook": "^2.1.0",
|
||||||
|
"universal-user-agent": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/endpoint": {
|
"@octokit/endpoint": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.2.tgz",
|
||||||
"integrity": "sha512-pOPHaSz57SFT/m3R5P8MUu4wLPszokn5pXcB/pzavLTQf2jbU+6iayTvzaY6/BiotuRS0qyEUkx3QglT4U958A==",
|
"integrity": "sha512-xs1mmCEZ2y4shXCpFjNq3UbmNR+bLzxtZim2L0zfEtj9R6O6kc4qLDvYw66hvO6lUsYzPTM5hMkltbuNAbRAcQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^2.11.1",
|
"@octokit/types": "^4.0.1",
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"universal-user-agent": "^5.0.0"
|
"universal-user-agent": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/graphql": {
|
"@octokit/graphql": {
|
||||||
"version": "4.4.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.0.tgz",
|
||||||
"integrity": "sha512-Du3hAaSROQ8EatmYoSAJjzAz3t79t9Opj/WY1zUgxVUGfIKn0AEjg+hlOLscF6fv6i/4y/CeUvsWgIfwMkTccw==",
|
"integrity": "sha512-StJWfn0M1QfhL3NKBz31e1TdDNZrHLLS57J2hin92SIfzlOVBuUaRkp31AGkGOAFOAVtyEX6ZiZcsjcJDjeb5g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/request": "^5.3.0",
|
"@octokit/request": "^5.3.0",
|
||||||
"@octokit/types": "^2.0.0",
|
"@octokit/types": "^4.0.1",
|
||||||
"universal-user-agent": "^5.0.0"
|
"universal-user-agent": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-paginate-rest": {
|
"@octokit/plugin-paginate-rest": {
|
||||||
"version": "1.1.2",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.1.tgz",
|
||||||
"integrity": "sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q==",
|
"integrity": "sha512-/tHpIF2XpN40AyhIq295YRjb4g7Q5eKob0qM3thYJ0Z+CgmNsWKM/fWse/SUR8+LdprP1O4ZzSKQE+71TCwK+w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^2.0.1"
|
"@octokit/types": "^4.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-request-log": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw=="
|
|
||||||
},
|
|
||||||
"@octokit/plugin-rest-endpoint-methods": {
|
"@octokit/plugin-rest-endpoint-methods": {
|
||||||
"version": "2.4.0",
|
"version": "3.17.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz",
|
||||||
"integrity": "sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ==",
|
"integrity": "sha512-NFV3vq7GgoO2TrkyBRUOwflkfTYkFKS0tLAPym7RNpkwLCttqShaEGjthOsPEEL+7LFcYv3mU24+F2yVd3npmg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^2.0.1",
|
"@octokit/types": "^4.1.6",
|
||||||
"deprecation": "^2.3.1"
|
"deprecation": "^2.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/request": {
|
"@octokit/request": {
|
||||||
"version": "5.4.2",
|
"version": "5.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.2.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.4.tgz",
|
||||||
"integrity": "sha512-zKdnGuQ2TQ2vFk9VU8awFT4+EYf92Z/v3OlzRaSh4RIP0H6cvW1BFPXq4XYvNez+TPQjqN+0uSkCYnMFFhcFrw==",
|
"integrity": "sha512-vqv1lz41c6VTxUvF9nM+a6U+vvP3vGk7drDpr0DVQg4zyqlOiKVrY17DLD6de5okj+YLHKcoqaUZTBtlNZ1BtQ==",
|
||||||
"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": "^2.11.1",
|
"@octokit/types": "^4.0.1",
|
||||||
"deprecation": "^2.0.0",
|
"deprecation": "^2.0.0",
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"node-fetch": "^2.3.0",
|
"node-fetch": "^2.3.0",
|
||||||
@@ -853,62 +886,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/request-error": {
|
"@octokit/request-error": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.1.tgz",
|
||||||
"integrity": "sha512-rtYicB4Absc60rUv74Rjpzek84UbVHGHJRu4fNVlZ1mCcyUPPuzFfG9Rn6sjHrd95DEsmjSt1Axlc699ZlbDkw==",
|
"integrity": "sha512-5lqBDJ9/TOehK82VvomQ6zFiZjPeSom8fLkFVLuYL3sKiIb5RB8iN/lenLkY7oBmyQcGP7FBMGiIZTO8jufaRQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^2.0.0",
|
"@octokit/types": "^4.0.1",
|
||||||
"deprecation": "^2.0.0",
|
"deprecation": "^2.0.0",
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/rest": {
|
|
||||||
"version": "16.43.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.1.tgz",
|
|
||||||
"integrity": "sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/auth-token": "^2.4.0",
|
|
||||||
"@octokit/plugin-paginate-rest": "^1.1.1",
|
|
||||||
"@octokit/plugin-request-log": "^1.0.0",
|
|
||||||
"@octokit/plugin-rest-endpoint-methods": "2.4.0",
|
|
||||||
"@octokit/request": "^5.2.0",
|
|
||||||
"@octokit/request-error": "^1.0.2",
|
|
||||||
"atob-lite": "^2.0.0",
|
|
||||||
"before-after-hook": "^2.0.0",
|
|
||||||
"btoa-lite": "^1.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"lodash.get": "^4.4.2",
|
|
||||||
"lodash.set": "^4.3.2",
|
|
||||||
"lodash.uniq": "^4.5.0",
|
|
||||||
"octokit-pagination-methods": "^1.1.0",
|
|
||||||
"once": "^1.4.0",
|
|
||||||
"universal-user-agent": "^4.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/request-error": {
|
|
||||||
"version": "1.2.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz",
|
|
||||||
"integrity": "sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA==",
|
|
||||||
"requires": {
|
|
||||||
"@octokit/types": "^2.0.0",
|
|
||||||
"deprecation": "^2.0.0",
|
|
||||||
"once": "^1.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"universal-user-agent": {
|
|
||||||
"version": "4.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz",
|
|
||||||
"integrity": "sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg==",
|
|
||||||
"requires": {
|
|
||||||
"os-name": "^3.1.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"@octokit/types": {
|
"@octokit/types": {
|
||||||
"version": "2.16.0",
|
"version": "4.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.16.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.6.tgz",
|
||||||
"integrity": "sha512-hA06ZYqkAVxvwFVu7yqRNVBGfG9MZvLMbqfgfm6F79g5xWspxsbL/2/rHcFP/z1YBN3zbcNQYuUHiBml4b24MA==",
|
"integrity": "sha512-/gN/VeZirpFb0GIpbDF6SgtfDp9EQ+ymqPf595wjRkEoRgkrCnJGctGAd8MrynStBvYRmMWF1P64qzZFzhW7Vg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": ">= 8"
|
"@types/node": ">= 8"
|
||||||
}
|
}
|
||||||
@@ -1017,9 +1007,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "13.13.5",
|
"version": "14.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.5.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.10.tgz",
|
||||||
"integrity": "sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g=="
|
"integrity": "sha512-Bz23oN/5bi0rniKT24ExLf4cK0JdvN3dH/3k0whYkdN4eI4vS2ZW/2ENNn2uxHCzWcbdHIa/GRuWQytfzCjRYw=="
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -1280,11 +1270,6 @@
|
|||||||
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
|
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"atob-lite": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY="
|
|
||||||
},
|
|
||||||
"aws-sign2": {
|
"aws-sign2": {
|
||||||
"version": "0.7.0",
|
"version": "0.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
|
||||||
@@ -1486,11 +1471,6 @@
|
|||||||
"node-int64": "^0.4.0"
|
"node-int64": "^0.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"btoa-lite": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz",
|
|
||||||
"integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc="
|
|
||||||
},
|
|
||||||
"buffer-from": {
|
"buffer-from": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||||
@@ -3899,33 +3879,18 @@
|
|||||||
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lodash.get": {
|
|
||||||
"version": "4.4.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
|
||||||
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk="
|
|
||||||
},
|
|
||||||
"lodash.memoize": {
|
"lodash.memoize": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
|
||||||
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lodash.set": {
|
|
||||||
"version": "4.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz",
|
|
||||||
"integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM="
|
|
||||||
},
|
|
||||||
"lodash.sortby": {
|
"lodash.sortby": {
|
||||||
"version": "4.7.0",
|
"version": "4.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||||
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
|
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lodash.uniq": {
|
|
||||||
"version": "4.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
|
|
||||||
"integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M="
|
|
||||||
},
|
|
||||||
"lolex": {
|
"lolex": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz",
|
||||||
@@ -4378,11 +4343,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"octokit-pagination-methods": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ=="
|
|
||||||
},
|
|
||||||
"once": {
|
"once": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
@@ -6117,9 +6077,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"windows-release": {
|
"windows-release": {
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.1.tgz",
|
||||||
"integrity": "sha512-2HetyTg1Y+R+rUgrKeUEhAG/ZuOmTrI1NBb3ZyAGQMYmOJjBBPe4MTodghRkmLJZHwkuPi02anbeGP+Zf401LQ==",
|
"integrity": "sha512-Pngk/RDCaI/DkuHPlGTdIkDiTAnAkyMjoQMZqRsxydNl1qGXNIoZrB7RK8g53F2tEgQBMqQJHQdYZuQEEAu54A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"execa": "^1.0.0"
|
"execa": "^1.0.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -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": "1.0.0",
|
"version": "2.1.0",
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -35,8 +35,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^2.2.0"
|
"@actions/github": "^3.0.0",
|
||||||
|
"@actions/io": "^1.0.2",
|
||||||
|
"@octokit/core": "^2.5.3",
|
||||||
|
"@octokit/plugin-paginate-rest": "^2.2.1",
|
||||||
|
"@octokit/plugin-rest-endpoint-methods": "^3.17.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.1.4",
|
"@types/jest": "^25.1.4",
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {GitHub} from '@actions/github'
|
|
||||||
import {Context} from '@actions/github/lib/context'
|
import {Context} from '@actions/github/lib/context'
|
||||||
|
import {GitHub} from '@actions/github/lib/utils'
|
||||||
|
import * as io from '@actions/io'
|
||||||
|
|
||||||
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
|
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
|
||||||
|
|
||||||
type AsyncFunctionArguments = {
|
type AsyncFunctionArguments = {
|
||||||
context: Context
|
context: Context
|
||||||
core: typeof core
|
core: typeof core
|
||||||
github: GitHub
|
github: InstanceType<typeof GitHub>
|
||||||
|
io: typeof io
|
||||||
require: NodeRequire
|
require: NodeRequire
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import {context, GitHub} from '@actions/github'
|
import {context, getOctokit} from '@actions/github'
|
||||||
|
import * as io from '@actions/io'
|
||||||
import {callAsyncFunction} from './async-function'
|
import {callAsyncFunction} from './async-function'
|
||||||
|
|
||||||
process.on('unhandledRejection', handleError)
|
process.on('unhandledRejection', handleError)
|
||||||
@@ -22,12 +23,12 @@ async function main(): Promise<void> {
|
|||||||
if (userAgent != null) opts.userAgent = userAgent
|
if (userAgent != null) opts.userAgent = userAgent
|
||||||
if (previews != null) opts.previews = previews.split(',')
|
if (previews != null) opts.previews = previews.split(',')
|
||||||
|
|
||||||
const github = new GitHub(token, opts)
|
const github = getOctokit(token, opts)
|
||||||
const script = core.getInput('script', {required: true})
|
const script = core.getInput('script', {required: true})
|
||||||
|
|
||||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
||||||
const result = await callAsyncFunction(
|
const result = await callAsyncFunction(
|
||||||
{require: require, github, context, core},
|
{require: require, github, context, core, io},
|
||||||
script
|
script
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user