Compare commits

...

21 Commits
v5 ... v6.1.0

Author SHA1 Message Date
Josh Gross
7a5c598405 Merge pull request #263 from smaeda-ks/update-actions-core
Update `@actions/core` to 1.8.1
2022-05-12 18:43:19 -04:00
Josh Gross
cb1c1eb6df Classify http-client licenses 2022-05-12 18:41:55 -04:00
Josh Gross
6203d71574 Update licenses 2022-05-12 18:39:12 -04:00
Shohei Maeda
19fe498d7b Update @actions/core to 1.8.1 2022-05-13 07:29:57 +09:00
Josh Gross
9bd6ae64c1 Merge pull request #254 from dlech/patch-1
README: use pull_request_target in example
2022-03-31 17:21:17 -04:00
David Lechner
e44260d768 README: use pull_request_target in example
Pull requests from forks do not have write permission, so we need to use `pull_request_target` instead of `pull_request` to enable write permission.

Fixes #42.
2022-03-30 13:19:17 -05:00
Josh Gross
05418122f5 Merge pull request #251 from actions/dependabot/npm_and_yarn/minimist-1.2.6
Bump minimist from 1.2.5 to 1.2.6
2022-03-30 11:20:01 -04:00
Josh Gross
b82abb9b60 Merge pull request #252 from josh-/add-formatting-example-readme
Update README with Markdown text formatting example
2022-03-29 11:01:09 -04:00
Josh Parnham
d965d37133 Add text formatting example to README 2022-03-27 23:55:08 +11:00
dependabot[bot]
7cf7d15108 Bump minimist from 1.2.5 to 1.2.6
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 06:03:59 +00:00
Josh Gross
9ac08808f9 Merge pull request #240 from actions/joshmgross/document-esm
Add an example using ESM `import`
2022-02-11 10:21:32 -05:00
Josh Gross
53cdbb4a1b Merge pull request #239 from actions/joshmgross/v6
Release version 6.0.0
2022-02-11 10:21:20 -05:00
Josh Gross
6b8d8aaad4 Merge pull request #238 from actions/joshmgross/update-actions-core
Update `@actions/core` to 1.6.0
2022-02-11 10:19:36 -05:00
Josh Gross
6689be4f99 Merge pull request #237 from actions/joshmgross/audit-fix
Update `node-fetch`
2022-02-11 10:19:26 -05:00
Josh Gross
5541733ecf Add an example using ESM import 2022-02-09 16:17:11 -05:00
Josh Gross
cd8eebf4a5 Release version 6.0.0 2022-02-09 16:05:04 -05:00
Josh Gross
72fadf4ee8 Update @actions/core to 1.6.0 2022-02-09 15:58:07 -05:00
Josh Gross
d526c0463a Update node-fetch license 2022-02-09 15:54:39 -05:00
Josh Gross
2c946f132f Run npm audit fix 2022-02-09 15:47:54 -05:00
Josh Gross
41e1ab4f53 Merge pull request #235 from thboop/patch-1
Update default runtime to node16
2022-02-09 15:46:20 -05:00
Thomas Boop
d2ed94b14f Update default runtime to node16
Node 12 has an end of life on April 30, 2022.

This PR updates the default runtime to [node16](https://github.blog/changelog/2021-12-10-github-actions-github-hosted-runners-now-run-node-js-16-by-default/), rather then node12. 

This is supported on all Actions Runners v2.285.0 or later.
2022-02-07 14:00:27 -05:00
9 changed files with 1328 additions and 47 deletions

View File

@@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 1.5.0
version: 1.8.1
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core

View File

@@ -0,0 +1,32 @@
---
name: "@actions/http-client"
version: 2.0.0
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@@ -1,6 +1,6 @@
---
name: node-fetch
version: 2.6.5
version: 2.6.7
type: npm
summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch

View File

@@ -32,7 +32,15 @@ defined, so you don't have to import them (see examples below).
See [octokit/rest.js](https://octokit.github.io/rest.js/) for the API client
documentation.
## Breaking changes in V5
## Breaking Changes
### Breaking changes in V6
Version 6 of this action updated the runtime to Node 16 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-using-nodejs-v16
All scripts are now run with Node 16 instead of Node 12 and are affected by any breaking changes between Node 12 and 16.
### Breaking changes in V5
Version 5 of this action includes the version 5 of `@actions/github` and `@octokit/plugin-rest-endpoint-methods`. As part of this update, the Octokit context available via `github` no longer has REST methods directly. These methods are available via `github.rest.*` - https://github.com/octokit/plugin-rest-endpoint-methods.js/releases/tag/v5.0.0
@@ -50,7 +58,7 @@ The return value of the script will be in the step's outputs under the
"result" key.
```yaml
- uses: actions/github-script@v5
- uses: actions/github-script@v6
id: set-result
with:
script: return "Hello!"
@@ -69,7 +77,7 @@ output of a github-script step. For some workflows, string encoding is preferred
`result-encoding` input:
```yaml
- uses: actions/github-script@v5
- uses: actions/github-script@v6
id: my-script
with:
result-encoding: string
@@ -87,7 +95,7 @@ By default, github-script will use the token provided to your workflow.
```yaml
- name: View context attributes
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
script: console.log(context)
```
@@ -103,7 +111,7 @@ jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
@@ -125,7 +133,7 @@ jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
@@ -138,14 +146,16 @@ jobs:
### Welcome a first-time contributor
You can format text in comments using the same [Markdown syntax](https://docs.github.com/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) as the GitHub web interface:
```yaml
on: pull_request
on: pull_request_target
jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
// Get a list of all issues created by the PR opener
@@ -172,7 +182,9 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Welcome, new contributor!'
body: `**Welcome**, new contributor!
Please make sure you're read our [contributing guide](CONTRIBUTING.md) and we look forward to reviewing your Pull request shortly ✨`
})
```
@@ -188,7 +200,7 @@ jobs:
diff:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
const diff_url = context.payload.pull_request.diff_url
@@ -212,7 +224,7 @@ jobs:
list-issues:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
const query = `query($owner:String!, $name:String!, $label:String!) {
@@ -246,7 +258,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
const script = require('./path/to/script.js')
@@ -284,7 +296,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/github-script@v5
- uses: actions/github-script@v6
env:
SHA: '${{env.parentSHA}}'
with:
@@ -328,7 +340,7 @@ jobs:
- run: npm ci
# or one-off:
- run: npm install execa
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
script: |
const execa = require('execa')
@@ -338,6 +350,31 @@ jobs:
console.log(stdout)
```
### Use ESM `import`
To import an ESM file, you'll need to reference your script by an absolute path and ensure you have a `package.json` file with `"type": "module"` specified.
For a script in your repository `src/print-stuff.js`:
```js
export default function printStuff() { console.log('stuff') }
```
```yaml
on: push
jobs:
print-stuff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/github-script@v6
with:
script: |
const { default: printStuff } = await import('${{ github.workspace }}/src/print-stuff.js')
await printStuff()
```
### Use env as input
You can set env vars to use them in your script:
@@ -349,7 +386,7 @@ jobs:
echo-input:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
env:
FIRST_NAME: Mona
LAST_NAME: Octocat
@@ -377,7 +414,7 @@ jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.MY_PAT }}
script: |

View File

@@ -27,5 +27,5 @@ outputs:
result:
description: The return value of the script, stringified with `JSON.stringify`
runs:
using: node12
using: node16
main: dist/index.js

1194
dist/index.js vendored

File diff suppressed because it is too large Load Diff

68
package-lock.json generated
View File

@@ -1,15 +1,15 @@
{
"name": "github-script",
"version": "5.1.0",
"version": "6.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "github-script",
"version": "5.1.0",
"version": "6.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.5.0",
"@actions/core": "^1.8.1",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@actions/glob": "^0.2.0",
@@ -34,9 +34,17 @@
}
},
"node_modules/@actions/core": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ=="
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.1.tgz",
"integrity": "sha512-LuFg2O/+rRrYxrdafnqH9mx6ADszKzQAhDuEhhMQIh47tsXzWkW4wXY5zvscqJ4KDywyJX0LA0pAESPLUjZXvw==",
"dependencies": {
"@actions/http-client": "^2.0.0"
}
},
"node_modules/@actions/core/node_modules/@actions/http-client": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.0.tgz",
"integrity": "sha512-fm1+OPPey5ypgStT9K8zbBhICj4J4UV/TJIHDhuWlkb8KyJaAtjcZK184dTqul0dV0nPKX97FNtDXX20BTLXSA=="
},
"node_modules/@actions/exec": {
"version": "1.1.0",
@@ -4703,9 +4711,9 @@
}
},
"node_modules/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"node_modules/ms": {
@@ -4727,14 +4735,22 @@
"dev": true
},
"node_modules/node-fetch": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-fetch/node_modules/tr46": {
@@ -6162,9 +6178,19 @@
},
"dependencies": {
"@actions/core": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ=="
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.1.tgz",
"integrity": "sha512-LuFg2O/+rRrYxrdafnqH9mx6ADszKzQAhDuEhhMQIh47tsXzWkW4wXY5zvscqJ4KDywyJX0LA0pAESPLUjZXvw==",
"requires": {
"@actions/http-client": "^2.0.0"
},
"dependencies": {
"@actions/http-client": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.0.tgz",
"integrity": "sha512-fm1+OPPey5ypgStT9K8zbBhICj4J4UV/TJIHDhuWlkb8KyJaAtjcZK184dTqul0dV0nPKX97FNtDXX20BTLXSA=="
}
}
},
"@actions/exec": {
"version": "1.1.0",
@@ -9749,9 +9775,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"ms": {
@@ -9773,9 +9799,9 @@
"dev": true
},
"node-fetch": {
"version": "2.6.5",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.5.tgz",
"integrity": "sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==",
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
"integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
"requires": {
"whatwg-url": "^5.0.0"
},

View File

@@ -1,7 +1,7 @@
{
"name": "github-script",
"description": "A GitHub action for executing a simple script",
"version": "5.1.0",
"version": "6.0.0",
"author": "GitHub",
"license": "MIT",
"main": "dist/index.js",
@@ -31,7 +31,7 @@
}
},
"dependencies": {
"@actions/core": "^1.5.0",
"@actions/core": "^1.8.1",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.0.0",
"@actions/glob": "^0.2.0",
@@ -54,4 +54,4 @@
"ts-jest": "^27.0.5",
"typescript": "^4.3.5"
}
}
}