Compare commits

..
112 Commits
Author SHA1 Message Date
Jonathan Clem 048309c447 Bump to v1 2020-05-18 14:32:21 -04:00
Jonathan Clem a8704b62a3 Add note about checkout to separate file docs 2020-05-18 12:59:15 -04:00
Jonathan Clem e16145c72e Merge pull request #50 from actions/readme-update
Add step results section to readme
2020-05-18 12:55:07 -04:00
Jonathan Clem dd16c14e71 Move another section in the wrong place 2020-05-18 12:54:07 -04:00
Jonathan Clem 5d33ffc89d Fix step ID in output example 2020-05-18 12:53:18 -04:00
Jonathan Clem adb3d5168d Fix section not moved 2020-05-18 12:52:37 -04:00
Jonathan Clem 181dcc219c Add step results section to readme 2020-05-18 12:51:39 -04:00
Jonathan Clem 6f0504cb03 Merge pull request #45 from tevoinea/patch-1
Add example on how to get the step result
2020-05-18 12:48:21 -04:00
Jonathan Clem d89db5b6f4 s/script/module 2020-05-18 12:41:53 -04:00
Jonathan Clem 52110c52e9 Add a separate file example 2020-05-18 12:38:49 -04:00
Jonathan Clem f498913621 Merge pull request #48 from actions/code-quality
Code quality improvements
2020-05-18 11:34:07 -04:00
Jonathan Clem 58f0ff84d6 Add style:check to ci workflow 2020-05-18 11:33:04 -04:00
Jonathan Clem 3037861304 Add ESLint and Prettier 2020-05-18 11:28:54 -04:00
Jonathan Clem b945d091bf Check in .vscode 2020-05-18 11:27:26 -04:00
Jonathan Clem ca14121875 Merge pull request #47 from actions/users/paquirk/ghesfixes
Bumping actions/core and actions/github dependencies for GHES
2020-05-14 18:08:58 -04:00
PJ Quirk ca6d0aaa59 Fixing exports in generated file 2020-05-14 18:05:57 -04:00
PJ Quirk 5d879b69aa Revert changes to tsc/ncc 2020-05-14 17:16:50 -04:00
Jonathan Clem 1bc9cbef6c Merge pull request #46 from nschonni/patch-1
fix: Example YAML schema to match Actions Docs
2020-05-14 16:22:01 -04:00
PJ Quirk 9a58186a54 Combine build/pack 2020-05-12 15:54:30 -04:00
PJ Quirk 8934ce0ffe Fix pack step and re-run 2020-05-12 15:20:35 -04:00
PJ Quirk 05997a2463 Fix build steps 2020-05-12 15:09:19 -04:00
PJ Quirk 1bc2687309 Bump package versions 2020-05-12 15:08:00 -04:00
Nick Schonning 97fd3f1973 fix: Example YAML schema to match Actions Docs
Both ways should be valid, but the regular nested YAML keys seems to be the format of the regular GitHub Actions docs
2020-05-09 13:09:30 -04:00
Teo Voinea f8e6050e29 Add example on how to get the step result 2020-05-07 18:19:02 -07:00
Jonathan Clem 648bc46b8a Merge pull request #37 from localheinz/fix/three
Fix: README.md
2020-04-20 12:25:29 -04:00
Andreas Möller 1268370776 Fix: README.md 2020-03-27 12:38:18 +01:00
Jonathan Clem 5d03ada4b0 0.9.0 2020-03-24 15:14:05 -04:00
Jonathan Clem 293ee0ca2d Uninstall/reinstall ts-jest 2020-03-24 15:07:44 -04:00
Jonathan Clem 67d29bab15 Merge pull request #36 from actions/bump-dependencies
Uninstall/reinstall Jest (for minimist update)
2020-03-24 15:00:02 -04:00
Jonathan Clem 0baa1791ca Merge pull request #35 from actions/bump-dependencies
Bump outdated npm packages
2020-03-24 14:58:02 -04:00
Jonathan Clem b4fd05ccdf Uninstall/reinstall Jest (for minimist update) 2020-03-24 14:57:31 -04:00
Jonathan Clem 2ccd1edaf4 Update ncc 2020-03-24 14:38:07 -04:00
Jonathan Clem a59996ab35 Update TypeScript 2020-03-24 14:37:22 -04:00
Jonathan Clem 7ca8635cd0 Bump @types/jest 2020-03-24 14:36:26 -04:00
Jonathan Clem 8117de6119 Bump @actions/core 2020-03-24 14:35:48 -04:00
Jonathan Clem 3f4f5a83e8 Merge pull request #34 from actions/dependabot/npm_and_yarn/acorn-6.4.1
Bump acorn from 6.4.0 to 6.4.1
2020-03-24 14:14:58 -04:00
dependabot[bot] 0e2c0d5c7c Bump acorn from 6.4.0 to 6.4.1
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <[email protected]>
2020-03-24 18:11:43 +00:00
Jonathan Clem 0d15461bee Merge pull request #33 from actions/add-core
Add core to execution context
2020-03-24 14:08:04 -04:00
Jonathan Clem e4cc5a8d47 Add core to README 2020-03-24 14:06:45 -04:00
Jonathan Clem dc16f26602 Add core to integration test 2020-03-24 14:02:45 -04:00
Jonathan Clem 8982156783 Add core to the script context 2020-03-24 13:57:27 -04:00
Jonathan Clem 80a5e943b4 v0.8.0 2020-02-28 09:18:07 -05:00
Jonathan Clem 0cb5c91bd3 Update README.md 2020-02-28 09:12:55 -05:00
Jonathan Clem 493b839630 Remove output log 2020-02-28 09:09:06 -05:00
Jonathan Clem 904b439f45 Set output 2020-02-28 09:07:52 -05:00
Jonathan Clem 1e169ae445 Remove result temporarily 2020-02-28 09:06:03 -05:00
Jonathan Clem 62fdca610c Remove log result 2020-02-28 08:54:30 -05:00
Jonathan Clem 26ee3d2d09 Test log result 2020-02-28 08:52:13 -05:00
Jonathan Clem be5d094bf9 Remove async from callAsyncFunction 2020-02-28 08:51:05 -05:00
Jonathan Clem 3758c2b05b Add result log 2020-02-28 08:50:21 -05:00
Jonathan Clem 317a0746d1 Remove core again for now 2020-02-28 08:49:25 -05:00
Jonathan Clem ec171b8961 Use master 2020-02-27 17:53:27 -05:00
Jonathan Clem d73e75dea8 Separate integration workflow 2020-02-27 17:52:43 -05:00
Jonathan Clem 7afad1e364 Add core 2020-02-27 17:43:18 -05:00
Jonathan Clem ebe3cb13e0 Add some test workflows 2020-02-27 17:39:50 -05:00
Jonathan Clem 38e3ffe4c6 Add tests for the AsyncFunction 2020-02-27 17:27:49 -05:00
Jonathan Clem 6eefe48bc9 Update @actions NPM dependencies 2020-02-27 16:52:48 -05:00
Jonathan Clem 5363c89495 v0.6.0 2020-02-25 15:45:01 -05:00
Jonathan Clem b20057aecf Target es2018 2020-02-25 15:42:58 -05:00
Jonathan Clem ebc5283d9c Remove yarn.lock 2020-02-25 15:42:43 -05:00
Jonathan Clem f3c2f2ea28 Bump v0.5.0 2020-02-13 14:17:57 -05:00
Jonathan Clem 8e6ec0efea Add development docs 2020-02-13 14:17:08 -05:00
Jonathan Clem c98effd497 Add README content about github-token 2020-02-13 14:07:32 -05:00
Jonathan Clem e26865c60b Merge pull request #24 from joshmgross/master
Default to the GitHub token
2020-02-13 14:05:12 -05:00
Josh Gross 1d4576cfc1 Default to the GitHub token 2020-01-22 22:26:04 -05:00
Jonathan Clem 70e1324591 Merge pull request #22 from jcansdale/patch-1
Fix example context properties
2020-01-16 10:42:30 -05:00
Jamie Cansdale 45a1478a3c Fix other examples 2020-01-13 01:29:26 +00:00
Jamie Cansdale b57a417097 Use context.issue and context.repo 2020-01-13 01:25:26 +00:00
Jamie Cansdale 966982d0f8 Use fields on context.payload 2020-01-13 00:47:30 +00:00
Jonathan Clem 5bc9a17b5e Merge pull request #19 from francisfuzz/francisfuzz/husky
feat(build): use husky for pre-commit
2020-01-08 17:18:45 -05:00
Jonathan Clem aa2b350b20 Update index.js 2020-01-08 17:13:53 -05:00
Jonathan Clem 49479481d1 Revert dist/index.js to master 2020-01-08 17:13:33 -05:00
Jonathan Clem 173930380c Update index.js 2020-01-08 17:13:09 -05:00
francisfuzz 2df917a7ec reset dist/index.js back to 1daa763e63 2020-01-08 12:51:55 -08:00
francisfuzz e27277ca72 re-commit dist/index.js 2020-01-08 12:44:56 -08:00
francisfuzz ad75d095ea remove dist/index.js 2020-01-08 12:43:34 -08:00
Jonathan Clem f2f148bee6 Merge branch 'master' into francisfuzz/husky 2020-01-08 15:23:21 -05:00
Jonathan Clem 1daa763e63 Merge pull request #20 from actions/typescript
Use TypeScript
2020-01-08 15:22:37 -05:00
Jonathan Clem 2adb4f3620 Use TypeScript 2020-01-08 15:17:10 -05:00
francisfuzz 38e28a96bd feat(build): use husky for pre-commit 2020-01-08 12:14:39 -08:00
Jonathan Clem 83e4cfe60a Bump to 0.4.0 2020-01-08 14:58:37 -05:00
Jonathan Clem 29c97cb536 Merge pull request #18 from actions/result-encoding
Result encoding
2020-01-08 14:57:34 -05:00
Jonathan Clem de1677be2d Add string-encoding example to README 2020-01-08 14:56:44 -05:00
Jonathan Clem 99889c25e0 Fix result-enoding/encoding typo 2020-01-08 14:53:04 -05:00
Jonathan Clem 9abe67e516 Encode result into output 2020-01-08 14:40:07 -05:00
Jonathan Clem 622ce3121a Accept json or string encoding of result 2020-01-08 14:39:09 -05:00
Jonathan Clem 1a49f59545 Handle deprecation of number param in Octokit 2020-01-08 14:30:48 -05:00
Jonathan Clem 70dbd8d3ba Merge pull request #17 from francisfuzz/francisfuzz/ncc
Use @zeit/ncc instead of checking in node_modules
2020-01-08 14:14:17 -05:00
francisfuzz 5abce7d243 chore: update package.json metadata 2020-01-03 09:30:21 -08:00
francisfuzz 93e067c319 feature: build source file with ncc 2020-01-03 09:19:52 -08:00
francisfuzz ae247f778e config: ignore node_modules 2020-01-03 09:16:55 -08:00
francisfuzz d9c834f45d remove node_modules 2020-01-03 09:16:17 -08:00
Jonathan Clem 11098d4ae3 Merge pull request #13 from orta/patch-1
Update versions in README.md
2019-11-21 08:45:17 -05:00
Jonathan Clem 87914af509 Update README.md 2019-11-21 08:43:14 -05:00
Orta f59de04a66 Update README.md 2019-11-18 14:38:58 -05:00
Jonathan Clem 9f3a1f1343 Add GitHub as author 2019-11-13 15:04:08 -08:00
Jonathan Clem 72fd1e6109 Make some minor changes to README 2019-11-13 15:03:01 -08:00
Jonathan Clem 470a4bfd94 Merge pull request #11 from actions/ethomson/update_description
Update description
2019-11-13 15:02:38 -08:00
Jonathan Clem 71fcc9050d Pass "require" to function context 2019-11-13 14:54:26 -08:00
Edward Thomson 4f0c94ef13 Update description 2019-11-08 16:22:35 +00:00
Jonathan Clem d910cb8d03 Merge pull request #4 from JJ/master
Adds example that uses the github object
2019-11-07 11:16:48 -05:00
Juan Julián Merelo GuervósandJonathan Clem 4404120432 Update README.md as requested
Co-Authored-By: Jonathan Clem <[email protected]>
2019-09-17 21:40:17 +02:00
Juan Julián Merelo GuervósandJonathan Clem 1d11b7fefb Update README.md as requested
Co-Authored-By: Jonathan Clem <[email protected]>
2019-09-17 21:39:56 +02:00
Jonathan Clem 47683009b7 Update README.md 2019-09-17 15:07:13 -04:00
JJ Merelo 4418551f1d Adds example with use of github object 2019-09-06 09:15:54 +02:00
Jonathan Clem e5da67d395 Use 0.2.0 in README 2019-09-05 12:03:28 -04:00
Jonathan Clem 4d2b828632 Merge pull request #2 from actions/client-options
Add client options
2019-09-05 12:02:21 -04:00
Jonathan Clem fbe453a850 Transform inputs from strings 2019-09-05 11:39:22 -04:00
Jonathan Clem e6944039f8 Remove empty list from action.yml 2019-09-05 11:34:38 -04:00
Jonathan Clem 0f28aeff3d Pass input options to GitHub constructor 2019-09-05 11:29:31 -04:00
Jonathan Clem 1aae562f16 Use @actions/core 1.1.0 and @actions/github 1.1.0 2019-09-05 11:29:12 -04:00
Jonathan Clem e3df9c68fb Add debug, user-agent, and previews inputs 2019-09-05 09:35:47 -04:00
375 changed files with 32141 additions and 77534 deletions
+13
View File
@@ -0,0 +1,13 @@
root: true
parser: '@typescript-eslint/parser'
plugins: ['@typescript-eslint']
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
- prettier/@typescript-eslint
rules:
# '@typescript-eslint/explicit-function-return-type': 0
'@typescript-eslint/no-use-before-define':
- 2
- functions: false
+19
View File
@@ -0,0 +1,19 @@
on:
push: {branches: master}
pull_request: {branches: master}
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with: {node-version: 13.x}
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{runner.os}}-npm-${{hashFiles('**/package-lock.json')}}
restore-keys: ${{runner.os}}-npm-
- run: npm ci
- run: npm run style:check
- run: npm test
+17
View File
@@ -0,0 +1,17 @@
on:
push: {branches: master}
jobs:
integration:
runs-on: ubuntu-latest
steps:
- id: output-set
uses: actions/github-script@master
with:
script: return core.getInput('input-value')
result-encoding: string
input-value: output
- run: |
if [[ "${{steps.output-set.outputs.result}}" != "output" ]]; then
exit 1
fi
+2 -1
View File
@@ -1 +1,2 @@
!node_modules
/node_modules/
!/.vscode/
+5
View File
@@ -0,0 +1,5 @@
arrowParens: avoid
bracketSpacing: false
semi: false
singleQuote: true
trailingComma: none
+10
View File
@@ -0,0 +1,10 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"files.exclude": {
"**/dist": true,
"**/node_modules": true
}
}
+139 -15
View File
@@ -1,16 +1,17 @@
# github-script
# 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)
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. Two arguments will
be provided:
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/tree/master/packages/github)
- `core` A reference to the [@actions/core](https://github.com/actions/toolkit/tree/master/packages/core) package
Since the `script` is just a function body, these values will already be
defined, so you don't have to (see examples below).
@@ -19,42 +20,96 @@ 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. 🙂
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@v1
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@v1
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:
issue: {type: opened}
issues:
types: [opened]
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.1.0
- uses: actions/github-script@v1
with:
github-token: ${{github.token}}
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.createComment({...context.issue, body: '👋 Thanks for reporting!'})
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Thanks for reporting!'
})
```
### Apply a label to an issue
```yaml
on:
issue: {type: opened}
issues:
types: [opened]
jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.1.0
- uses: actions/github-script@v1
with:
github-token: ${{github.token}}
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.issues.addLabels({...context.issue, labels: ['Triage']})
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Triage']
})
```
### Welcome a first-time contributor
@@ -66,9 +121,9 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.1.0
- uses: actions/github-script@v1
with:
github-token: ${{github.token}}
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
@@ -90,5 +145,74 @@ jobs:
}
}
await github.issues.createComment({...context.issue, body: 'Welcome, new contributor!'})
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@v1
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)
```
This will print the full diff object in the screen; `result.data` will
contain the actual diff text.
### Run a separate file
If you don't want to inline your entire script that you want to run, you can
use a separate JavaScript module in your repository like so:
```yaml
on: push
jobs:
echo-input:
runs-on: ubuntu-latest
steps:
- uses: @actions/checkout@v2
- uses: @actions/github-script@v1
with:
script: |
const path = require('path')
const scriptPath = path.resolve('./path/to/script.js')
console.log(require(scriptPath)({context}))
```
And then export a function from your module:
```javascript
module.exports = ({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.
+28
View File
@@ -0,0 +1,28 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import {callAsyncFunction} from '../src/async-function'
describe('callAsyncFunction', () => {
test('calls the function with its arguments', async () => {
const result = await callAsyncFunction({foo: 'bar'} as any, 'return foo')
expect(result).toEqual('bar')
})
test('throws on ReferenceError', async () => {
expect.assertions(1)
try {
await callAsyncFunction({} as any, 'proces')
} catch (err) {
expect(err).toBeInstanceOf(ReferenceError)
}
})
test('can access process', async () => {
await callAsyncFunction({} as any, 'process')
})
test('can access console', async () => {
await callAsyncFunction({} as any, 'console')
})
})
+16 -3
View File
@@ -1,5 +1,6 @@
name: GitHub Script
description: An action for running simple scripts with a GitHub client
author: GitHub
description: Run simple scripts using the GitHub client
branding:
color: blue
icon: code
@@ -9,10 +10,22 @@ inputs:
required: true
github-token:
description: The GitHub token used to create an authenticated client
required: true
default: ${{ github.token }}
required: false
debug:
description: Whether to tell the GitHub client to log details of its requests
default: false
user-agent:
description: An optional user-agent string
default: actions/github-script
previews:
description: A comma-separated list of API previews to accept
result-encoding:
description: Either "string" or "json" (default "json")—how the result will be encoded
default: json
outputs:
result:
description: The return value of the script, stringified with `JSON.stringify`
runs:
using: node12
main: main.js
main: dist/index.js
+25486
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -0,0 +1,28 @@
# Development
## How this action works
This action works by evaluating the user input as the body of an asynchronous
JavaScript function. See [main.ts](/src/main.ts) for details.
## Building
Before the action can be used, it needs to be compiled to JavaScript:
```shell
bash> npm run build
```
It also has a pre-commit hook configured via
[husky](https://www.npmjs.com/package/husky) that should run the build script
before each commit. Additionally, this hook formats code and lints it, as
well.
## Releasing
Releases are done manually, for now:
1. Ensure that the build is up to date with `npm run build`.
1. Bump the [package.json](/package.json#L3) and [package-lock.json](/package-lock.json#L3) version numbers and commit them.
1. Update documentation (including updated version numbers).
1. Tag master with the new version number and create a GitHub release.
-20
View File
@@ -1,20 +0,0 @@
const core = require('@actions/core')
const {GitHub, context} = require('@actions/github')
process.on('unhandledRejection', handleError)
main().catch(handleError)
async function main() {
const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor
const script = core.getInput('script', {required: true})
const token = core.getInput('github-token', {required: true})
const fn = new AsyncFunction('github', 'context', script)
const client = new GitHub(token)
const result = await fn(client, context)
core.setOutput('result', JSON.stringify(result))
}
function handleError(err) {
console.error(err)
core.setFailed(err.message)
}
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../semver/bin/semver
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../which/bin/which
-63
View File
@@ -1,63 +0,0 @@
{
"systemParams": "darwin-x64-72",
"modulesFolders": [
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [
"@actions/core@^1.0.0",
"@actions/github@^1.0.0"
],
"lockfileEntries": {
"@actions/core@^1.0.0": "https://registry.yarnpkg.com/@actions/core/-/core-1.0.0.tgz#4a090a2e958cc300b9ea802331034d5faf42d239",
"@actions/github@^1.0.0": "https://registry.yarnpkg.com/@actions/github/-/github-1.0.0.tgz#5154cadd93c4b17217f56304ee27056730b8ae88",
"@octokit/endpoint@^5.1.0": "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.3.2.tgz#2deda2d869cac9ba7f370287d55667be2a808d4b",
"@octokit/graphql@^2.0.1": "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-2.1.3.tgz#60c058a0ed5fa242eca6f938908d95fd1a2f4b92",
"@octokit/request-error@^1.0.1": "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.0.4.tgz#15e1dc22123ba4a9a4391914d80ec1e5303a23be",
"@octokit/request-error@^1.0.2": "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.0.4.tgz#15e1dc22123ba4a9a4391914d80ec1e5303a23be",
"@octokit/request@^5.0.0": "https://registry.yarnpkg.com/@octokit/request/-/request-5.0.2.tgz#59a920451f24811c016ddc507adcc41aafb2dca5",
"@octokit/rest@^16.15.0": "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.28.7.tgz#a2c2db5b318da84144beba82d19c1a9dbdb1a1fa",
"atob-lite@^2.0.0": "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696",
"before-after-hook@^2.0.0": "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635",
"btoa-lite@^1.0.0": "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337",
"cross-spawn@^6.0.0": "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4",
"[email protected]": "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.0.0.tgz#3e3110ca29205f120d7cb064960a39c3d2087c09",
"deprecation@^2.0.0": "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919",
"end-of-stream@^1.1.0": "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43",
"execa@^1.0.0": "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8",
"get-stream@^4.0.0": "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5",
"is-plain-object@^3.0.0": "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928",
"is-stream@^1.1.0": "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44",
"isexe@^2.0.0": "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
"isobject@^4.0.0": "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0",
"lodash.get@^4.4.2": "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99",
"lodash.set@^4.3.2": "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23",
"lodash.uniq@^4.5.0": "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773",
"macos-release@^2.2.0": "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f",
"nice-try@^1.0.4": "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366",
"node-fetch@^2.3.0": "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd",
"npm-run-path@^2.0.0": "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f",
"octokit-pagination-methods@^1.1.0": "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4",
"once@^1.3.1": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"once@^1.4.0": "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1",
"os-name@^3.0.0": "https://registry.yarnpkg.com/os-name/-/os-name-3.1.0.tgz#dec19d966296e1cd62d701a5a66ee1ddeae70801",
"p-finally@^1.0.0": "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae",
"path-key@^2.0.0": "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40",
"path-key@^2.0.1": "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40",
"pump@^3.0.0": "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64",
"semver@^5.5.0": "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7",
"shebang-command@^1.2.0": "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea",
"shebang-regex@^1.0.0": "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3",
"signal-exit@^3.0.0": "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d",
"strip-eof@^1.0.0": "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf",
"universal-user-agent@^2.0.3": "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.1.0.tgz#5abfbcc036a1ba490cb941f8fd68c46d3669e8e4",
"universal-user-agent@^3.0.0": "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-3.0.0.tgz#4cc88d68097bffd7ac42e3b7c903e7481424b4b9",
"url-template@^2.0.8": "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21",
"which@^1.2.9": "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a",
"windows-release@^3.1.0": "https://registry.yarnpkg.com/windows-release/-/windows-release-3.2.0.tgz#8122dad5afc303d833422380680a79cdfa91785f",
"wrappy@1": "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
},
"files": [],
"artifacts": {}
}
-7
View File
@@ -1,7 +0,0 @@
Copyright 2019 GitHub
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.
-81
View File
@@ -1,81 +0,0 @@
# `@actions/core`
> Core functions for setting results, logging, registering secrets and exporting variables across actions
## Usage
#### Inputs/Outputs
You can use this library to get inputs or set outputs:
```
const core = require('@actions/core');
const myInput = core.getInput('inputName', { required: true });
// Do stuff
core.setOutput('outputKey', 'outputVal');
```
#### Exporting variables/secrets
You can also export variables and secrets for future steps. Variables get set in the environment automatically, while secrets must be scoped into the environment from a workflow using `{{ secret.FOO }}`. Secrets will also be masked from the logs:
```
const core = require('@actions/core');
// Do stuff
core.exportVariable('envVar', 'Val');
core.exportSecret('secretVar', variableWithSecretValue);
```
#### PATH Manipulation
You can explicitly add items to the path for all remaining steps in a workflow:
```
const core = require('@actions/core');
core.addPath('pathToTool');
```
#### Exit codes
You should use this library to set the failing exit code for your action:
```
const core = require('@actions/core');
try {
// Do stuff
}
catch (err) {
// setFailed logs the message and sets a failing exit code
core.setFailed(`Action failed with error ${err}`);
}
```
#### Logging
Finally, this library provides some utilities for logging:
```
const core = require('@actions/core');
const myInput = core.getInput('input');
try {
core.debug('Inside try block');
if (!myInput) {
core.warning('myInput wasnt set');
}
// Do stuff
}
catch (err) {
core.error('Error ${err}, action may still succeed though');
}
```
-16
View File
@@ -1,16 +0,0 @@
interface CommandProperties {
[key: string]: string;
}
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message: string): void;
export {};
-66
View File
@@ -1,66 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os");
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
*/
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL);
}
exports.issueCommand = issueCommand;
function issue(name, message) {
issueCommand(name, {}, message);
}
exports.issue = issue;
const CMD_PREFIX = '##[';
class Command {
constructor(command, properties, message) {
if (!command) {
command = 'missing.command';
}
this.command = command;
this.properties = properties;
this.message = message;
}
toString() {
let cmdStr = CMD_PREFIX + this.command;
if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' ';
for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key];
if (val) {
// safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)};`;
}
}
}
}
cmdStr += ']';
// safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
const message = `${this.message || ''}`;
cmdStr += escapeData(message);
return cmdStr;
}
}
function escapeData(s) {
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
}
function escape(s) {
return s
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
.replace(/]/g, '%5D')
.replace(/;/g, '%3B');
}
//# sourceMappingURL=command.js.map
File diff suppressed because one or more lines are too long
-73
View File
@@ -1,73 +0,0 @@
/**
* Interface for getInput options
*/
export interface InputOptions {
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
required?: boolean;
}
/**
* The code to exit an action
*/
export declare enum ExitCode {
/**
* A code indicating that the action was successful
*/
Success = 0,
/**
* A code indicating that the action was a failure
*/
Failure = 1
}
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
export declare function exportVariable(name: string, val: string): void;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
export declare function exportSecret(name: string, val: string): void;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
export declare function addPath(inputPath: string): void;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
export declare function getInput(name: string, options?: InputOptions): string;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
export declare function setOutput(name: string, value: string): void;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
export declare function setFailed(message: string): void;
/**
* Writes debug message to user log
* @param message debug message
*/
export declare function debug(message: string): void;
/**
* Adds an error issue
* @param message error issue message
*/
export declare function error(message: string): void;
/**
* Adds an warning issue
* @param message warning issue message
*/
export declare function warning(message: string): void;
-116
View File
@@ -1,116 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command");
const path = require("path");
/**
* The code to exit an action
*/
var ExitCode;
(function (ExitCode) {
/**
* A code indicating that the action was successful
*/
ExitCode[ExitCode["Success"] = 0] = "Success";
/**
* A code indicating that the action was a failure
*/
ExitCode[ExitCode["Failure"] = 1] = "Failure";
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
//-----------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
function exportVariable(name, val) {
process.env[name] = val;
command_1.issueCommand('set-env', { name }, val);
}
exports.exportVariable = exportVariable;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
function exportSecret(name, val) {
exportVariable(name, val);
command_1.issueCommand('set-secret', {}, val);
}
exports.exportSecret = exportSecret;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
function addPath(inputPath) {
command_1.issueCommand('add-path', {}, inputPath);
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
exports.addPath = addPath;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`);
}
return val.trim();
}
exports.getInput = getInput;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
function setOutput(name, value) {
command_1.issueCommand('set-output', { name }, value);
}
exports.setOutput = setOutput;
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
function setFailed(message) {
process.exitCode = ExitCode.Failure;
error(message);
}
exports.setFailed = setFailed;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/**
* Writes debug message to user log
* @param message debug message
*/
function debug(message) {
command_1.issueCommand('debug', {}, message);
}
exports.debug = debug;
/**
* Adds an error issue
* @param message error issue message
*/
function error(message) {
command_1.issue('error', message);
}
exports.error = error;
/**
* Adds an warning issue
* @param message warning issue message
*/
function warning(message) {
command_1.issue('warning', message);
}
exports.warning = warning;
//# sourceMappingURL=core.js.map
-1
View File
File diff suppressed because one or more lines are too long
-37
View File
@@ -1,37 +0,0 @@
{
"name": "@actions/core",
"version": "1.0.0",
"description": "Actions core lib",
"keywords": [
"core",
"actions"
],
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
"license": "MIT",
"main": "lib/core.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/toolkit.git"
},
"scripts": {
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"devDependencies": {
"@types/node": "^12.0.2"
},
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55"
}
-7
View File
@@ -1,7 +0,0 @@
Copyright 2019 GitHub
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.
-48
View File
@@ -1,48 +0,0 @@
# `@actions/github`
> A hydrated Octokit client.
## Usage
Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the API.
```
const github = require('@actions/github');
const core = require('@actions/core');
// This should be a token with access to your repository scoped in as a secret.
const myToken = core.getInput('myToken');
const octokit = new github.GitHub(myToken);
const pulls = await octokit.pulls.get({
owner: 'octokit',
repo: 'rest.js',
pull_number: 123,
mediaType: {
format: 'diff'
}
});
console.log(pulls);
```
You can also make GraphQL requests:
```
const result = await octokit.graphql(query, variables);
```
Finally, you can get the context of the current action:
```
const github = require('@actions/github');
const context = github.context;
const newIssue = await octokit.issues.create({
...context.repo,
title: 'New issue!',
body: 'Hello Universe!'
});
```
-26
View File
@@ -1,26 +0,0 @@
import { WebhookPayload } from './interfaces';
export declare class Context {
/**
* Webhook payload object that triggered the workflow
*/
payload: WebhookPayload;
eventName: string;
sha: string;
ref: string;
workflow: string;
action: string;
actor: string;
/**
* Hydrate the context from the environment
*/
constructor();
readonly issue: {
owner: string;
repo: string;
number: number;
};
readonly repo: {
owner: string;
repo: string;
};
}
-38
View File
@@ -1,38 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-require-imports */
class Context {
/**
* Hydrate the context from the environment
*/
constructor() {
this.payload = process.env.GITHUB_EVENT_PATH
? require(process.env.GITHUB_EVENT_PATH)
: {};
this.eventName = process.env.GITHUB_EVENT_NAME;
this.sha = process.env.GITHUB_SHA;
this.ref = process.env.GITHUB_REF;
this.workflow = process.env.GITHUB_WORKFLOW;
this.action = process.env.GITHUB_ACTION;
this.actor = process.env.GITHUB_ACTOR;
}
get issue() {
const payload = this.payload;
return Object.assign({}, this.repo, { number: (payload.issue || payload.pullRequest || payload).number });
}
get repo() {
if (process.env.GITHUB_REPOSITORY) {
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
return { owner, repo };
}
if (this.payload.repository) {
return {
owner: this.payload.repository.owner.login,
repo: this.payload.repository.name
};
}
throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
}
}
exports.Context = Context;
//# sourceMappingURL=context.js.map
File diff suppressed because one or more lines are too long
-8
View File
@@ -1,8 +0,0 @@
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
import Octokit from '@octokit/rest';
import * as Context from './context';
export declare const context: Context.Context;
export declare class GitHub extends Octokit {
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
constructor(token: string);
}

Some files were not shown because too many files have changed in this diff Show More