31 Commits

Author SHA1 Message Date
Peter Evans
c1daf2a5ee Merge pull request #17 from peter-evans/ci-fix
Fix CI workflow
2020-05-03 11:37:59 +09:00
Peter Evans
2c6e6ad52e Fix ci workflow 2020-05-03 11:30:33 +09:00
Peter Evans
ac04beb74d Merge pull request #14 from peter-evans/update-distribution
Update distribution
2020-05-02 21:58:08 +09:00
peter-evans
4c932e5fcf Update distribution 2020-05-02 10:28:15 +00:00
Peter Evans
c3983458b8 Merge pull request #15 from peter-evans/renovate/octokit-request-5.x
Update dependency @octokit/request to v5.4.2
2020-05-02 19:26:26 +09:00
Renovate Bot
0273c20a19 Update dependency jest to v25.5.4 2020-05-02 10:15:46 +00:00
Renovate Bot
c18d89812d Update dependency @octokit/request to v5.4.2 2020-05-02 09:37:58 +00:00
Peter Evans
87c9d703ce Merge pull request #13 from peter-evans/renovate/actions-core-1.x
Update dependency @actions/core to v1.2.4
2020-05-02 17:37:31 +09:00
Renovate Bot
79ebb27197 Update dependency @actions/core to v1.2.4 2020-05-02 08:28:23 +00:00
Peter Evans
070f6e1940 Merge pull request #12 from peter-evans/ci
Add CI workflow
2020-05-02 17:28:03 +09:00
Peter Evans
80521239f3 Add ci workflow 2020-05-02 17:25:16 +09:00
Peter Evans
22b027c6f6 Update README 2020-04-13 10:05:30 +09:00
Peter Evans
aa63154642 Merge pull request #11 from peter-evans/renovate/zeit-ncc-0.x
Update dependency @zeit/ncc to v0.22.1
2020-04-06 09:11:16 +09:00
Renovate Bot
fa5ce5b708 Update dependency @zeit/ncc to v0.22.1 2020-04-05 20:31:47 +00:00
Peter Evans
0aa5a24ce3 Merge pull request #9 from peter-evans/renovate/zeit-ncc-0.x
Update dependency @zeit/ncc to v0.22.0
2020-03-24 09:21:53 +09:00
Renovate Bot
22de67cbcd Update dependency @zeit/ncc to v0.22.0 2020-03-23 22:31:30 +00:00
Peter Evans
1e4d1b6ee6 Update README 2020-03-06 11:34:24 +09:00
Peter Evans
30e4e3c61c Merge pull request #6 from peter-evans/renovate/zeit-ncc-0.x
Update dependency @zeit/ncc to v0.21.1
2020-02-13 10:00:19 +09:00
Renovate Bot
8b55117fd3 Update dependency @zeit/ncc to v0.21.1 2020-02-12 16:54:07 +00:00
Peter Evans
cee9e0a8c3 Merge pull request #4 from peter-evans/renovate/zeit-ncc-0.x
Update dependency @zeit/ncc to v0.21.0
2020-01-05 08:07:49 +09:00
Renovate Bot
969582a5eb Update dependency @zeit/ncc to v0.21.0 2020-01-04 15:44:56 +00:00
Peter Evans
c8b367eb2d Update to checkout v2 2020-01-04 09:36:01 +09:00
Peter Evans
dd94f75873 Change script build to package 2020-01-04 09:35:47 +09:00
Peter Evans
23c9cd4b68 Update README 2019-12-05 01:18:06 +09:00
Peter Evans
bd127af08d Update workflow 2019-12-05 01:18:00 +09:00
Peter Evans
ee6a038929 Update README 2019-11-13 23:26:52 +09:00
Peter Evans
aaad5096a7 Update README 2019-11-11 23:35:49 +09:00
Peter Evans
6f1fae5558 Merge pull request #2 from peter-evans/renovate/pin-dependencies
Pin dependency @zeit/ncc to 0.20.5
2019-11-10 09:40:47 +09:00
Renovate Bot
72ff22d22a Pin dependency @zeit/ncc to 0.20.5 2019-11-10 00:40:01 +00:00
Peter Evans
01c2a6f449 Merge pull request #1 from peter-evans/renovate/configure
Configure Renovate
2019-11-10 09:39:44 +09:00
Renovate Bot
5e5f450278 Add renovate.json 2019-11-10 00:35:15 +00:00
10 changed files with 6610 additions and 149 deletions

17
.eslintrc.json Normal file
View File

@@ -0,0 +1,17 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}

67
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run test
- run: npm run package
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
target: [built, committed]
steps:
- uses: actions/checkout@v2
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Repository Dispatch
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: tests
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
package:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
commit-message: Update distribution
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: Update distribution
body: |
- Updates the distribution for changes on `master`
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-distribution

View File

@@ -1,13 +0,0 @@
name: Create Repository Dispatch
on: push
jobs:
createRepositoryDispatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Repository Dispatch
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: tests
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

View File

@@ -3,10 +3,10 @@ on:
repository_dispatch: repository_dispatch:
types: [tests] types: [tests]
jobs: jobs:
autopep8: tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
ref: ${{ github.event.client_payload.ref }} ref: ${{ github.event.client_payload.ref }}
- run: echo ${{ github.event.client_payload.sha }} - run: echo ${{ github.event.client_payload.sha }}

View File

@@ -7,7 +7,7 @@ A GitHub action to create a repository dispatch event.
```yml ```yml
- name: Repository Dispatch - name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1.0.0 uses: peter-evans/repository-dispatch@v1
with: with:
token: ${{ secrets.REPO_ACCESS_TOKEN }} token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: my-event event-type: my-event
@@ -18,7 +18,7 @@ A GitHub action to create a repository dispatch event.
- `token` (**required**) - A `repo` scoped GitHub [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). - `token` (**required**) - A `repo` scoped GitHub [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
- `repository` - The full name of the repository to send the dispatch. Defaults to the current repository. - `repository` - The full name of the repository to send the dispatch. Defaults to the current repository.
- `event-type` (**required**) - A custom webhook event name. - `event-type` (**required**) - A custom webhook event name.
- `client-payload` - JSON payload with extra information about the webhook event that your action or worklow may use. Default: {} - `client-payload` - JSON payload with extra information about the webhook event that your action or workflow may use. Default: {}
## Example ## Example
@@ -26,7 +26,7 @@ Here is an example setting all of the input parameters.
```yml ```yml
- name: Repository Dispatch - name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1.0.0 uses: peter-evans/repository-dispatch@v1
with: with:
token: ${{ secrets.REPO_ACCESS_TOKEN }} token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: username/my-repo repository: username/my-repo
@@ -35,6 +35,7 @@ Here is an example setting all of the input parameters.
``` ```
Here is an example `on: repository_dispatch` workflow to receive the event. Here is an example `on: repository_dispatch` workflow to receive the event.
Note that repository dispatch events will only trigger a workflow run if the workflow is committed to the default branch (usually `master`).
```yml ```yml
name: Repository Dispatch name: Repository Dispatch
@@ -42,15 +43,37 @@ on:
repository_dispatch: repository_dispatch:
types: [my-event] types: [my-event]
jobs: jobs:
autopep8: myEvent:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
with: with:
ref: ${{ github.event.client_payload.ref }} ref: ${{ github.event.client_payload.ref }}
- run: echo ${{ github.event.client_payload.sha }} - run: echo ${{ github.event.client_payload.sha }}
``` ```
## Client payload
The GitHub API allows a maximum of 10 top-level properties in the `client-payload` JSON.
If you use more than that you will see an error message like the following.
```
No more than 10 properties are allowed; 14 were supplied.
```
For example, this payload will fail because it has more than 10 top-level properties.
```yml
client-payload: ${{ toJson(github) }}
```
To solve this you can simply wrap the payload in a single top-level property.
The following payload will succeed.
```yml
client-payload: '{"github": ${{ toJson(github) }}}'
```
## License ## License
[MIT](LICENSE) [MIT](LICENSE)

243
dist/index.js vendored
View File

@@ -34,7 +34,7 @@ module.exports =
/******/ // the startup function /******/ // the startup function
/******/ function startup() { /******/ function startup() {
/******/ // Load entry module and return exports /******/ // Load entry module and return exports
/******/ return __webpack_require__(104); /******/ return __webpack_require__(676);
/******/ }; /******/ };
/******/ /******/
/******/ // run startup /******/ // run startup
@@ -239,9 +239,9 @@ function wrappy (fn, cb) {
/***/ }), /***/ }),
/***/ 18: /***/ 18:
/***/ (function() { /***/ (function(module) {
eval("require")("encoding"); module.exports = eval("require")("encoding");
/***/ }), /***/ }),
@@ -346,13 +346,21 @@ const windowsRelease = release => {
const ver = (version || [])[0]; const ver = (version || [])[0];
// Server 2008, 2012 and 2016 versions are ambiguous with desktop versions and must be detected at runtime. // Server 2008, 2012, 2016, and 2019 versions are ambiguous with desktop versions and must be detected at runtime.
// If `release` is omitted or we're on a Windows system, and the version number is an ambiguous version // If `release` is omitted or we're on a Windows system, and the version number is an ambiguous version
// then use `wmic` to get the OS caption: https://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx // then use `wmic` to get the OS caption: https://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx
// If the resulting caption contains the year 2008, 2012 or 2016, it is a server version, so return a server OS name. // If `wmic` is obsoloete (later versions of Windows 10), use PowerShell instead.
// If the resulting caption contains the year 2008, 2012, 2016 or 2019, it is a server version, so return a server OS name.
if ((!release || release === os.release()) && ['6.1', '6.2', '6.3', '10.0'].includes(ver)) { if ((!release || release === os.release()) && ['6.1', '6.2', '6.3', '10.0'].includes(ver)) {
const stdout = execa.sync('wmic', ['os', 'get', 'Caption']).stdout || ''; let stdout;
const year = (stdout.match(/2008|2012|2016/) || [])[0]; try {
stdout = execa.sync('powershell', ['(Get-CimInstance -ClassName Win32_OperatingSystem).caption']).stdout || '';
} catch (_) {
stdout = execa.sync('wmic', ['os', 'get', 'Caption']).stdout || '';
}
const year = (stdout.match(/2008|2012|2016|2019/) || [])[0];
if (year) { if (year) {
return `Server ${year}`; return `Server ${year}`;
} }
@@ -371,53 +379,6 @@ module.exports = windowsRelease;
module.exports = require("os"); module.exports = require("os");
/***/ }),
/***/ 104:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
const { inspect } = __webpack_require__(669);
const core = __webpack_require__(470);
const { request } = __webpack_require__(753);
async function run() {
try {
const inputs = {
token: core.getInput("token"),
repository: core.getInput("repository"),
eventType: core.getInput("event-type"),
clientPayload: core.getInput("client-payload")
};
core.debug(`Inputs: ${inspect(inputs)}`);
const repository = inputs.repository ? inputs.repository : process.env.GITHUB_REPOSITORY;
core.debug(`repository: ${repository}`);
const clientPayload = inputs.clientPayload ? inputs.clientPayload : '{}';
core.debug(`clientPayload: ${clientPayload}`);
await request(
`POST /repos/${repository}/dispatches`,
{
headers: {
authorization: `token ${inputs.token}`
},
mediaType: {
previews: ['everest']
},
event_type: `${inputs.eventType}`,
client_payload: JSON.parse(clientPayload),
}
);
} catch (error) {
core.debug(inspect(error));
core.setFailed(error.message);
}
}
run();
/***/ }), /***/ }),
/***/ 118: /***/ 118:
@@ -637,6 +598,7 @@ module.exports = require("https");
// ignored, since we can never get coverage for them. // ignored, since we can never get coverage for them.
var assert = __webpack_require__(357) var assert = __webpack_require__(357)
var signals = __webpack_require__(654) var signals = __webpack_require__(654)
var isWin = /^win/i.test(process.platform)
var EE = __webpack_require__(614) var EE = __webpack_require__(614)
/* istanbul ignore if */ /* istanbul ignore if */
@@ -726,6 +688,11 @@ signals.forEach(function (sig) {
/* istanbul ignore next */ /* istanbul ignore next */
emit('afterexit', null, sig) emit('afterexit', null, sig)
/* istanbul ignore next */ /* istanbul ignore next */
if (isWin && sig === 'SIGHUP') {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
sig = 'SIGINT'
}
process.kill(process.pid, sig) process.kill(process.pid, sig)
} }
} }
@@ -2680,7 +2647,7 @@ function withDefaults(oldDefaults, newDefaults) {
}); });
} }
const VERSION = "5.5.1"; const VERSION = "6.0.1";
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.
@@ -2805,17 +2772,24 @@ function errname(uv, code) {
"use strict"; "use strict";
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 }); Object.defineProperty(exports, "__esModule", { value: true });
const os = __webpack_require__(87); const os = __importStar(__webpack_require__(87));
/** /**
* Commands * Commands
* *
* Command Format: * Command Format:
* ##[name key=value;key=value]message * ::name key=value,key=value::message
* *
* Examples: * Examples:
* ##[warning]This is the user warning message * ::warning::This is the message
* ##[set-secret name=mypassword]definitelyNotAPassword! * ::set-env name=MY_VAR::some value
*/ */
function issueCommand(command, properties, message) { function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message); const cmd = new Command(command, properties, message);
@@ -2840,34 +2814,53 @@ class Command {
let cmdStr = CMD_STRING + this.command; let cmdStr = CMD_STRING + this.command;
if (this.properties && Object.keys(this.properties).length > 0) { if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' '; cmdStr += ' ';
let first = true;
for (const key in this.properties) { for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) { if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key]; const val = this.properties[key];
if (val) { if (val) {
// safely append the val - avoid blowing up when attempting to if (first) {
// call .replace() if message is not a string for some reason first = false;
cmdStr += `${key}=${escape(`${val || ''}`)},`; }
else {
cmdStr += ',';
}
cmdStr += `${key}=${escapeProperty(val)}`;
} }
} }
} }
} }
cmdStr += CMD_STRING; cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
// 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; return cmdStr;
} }
} }
function escapeData(s) { /**
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); * 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);
} }
function escape(s) { exports.toCommandValue = toCommandValue;
return s function escapeData(s) {
return toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
}
function escapeProperty(s) {
return toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D') .replace(/\r/g, '%0D')
.replace(/\n/g, '%0A') .replace(/\n/g, '%0A')
.replace(/]/g, '%5D') .replace(/:/g, '%3A')
.replace(/;/g, '%3B'); .replace(/,/g, '%2C');
} }
//# sourceMappingURL=command.js.map //# sourceMappingURL=command.js.map
@@ -4742,10 +4735,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
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 }); Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = __webpack_require__(431); const command_1 = __webpack_require__(431);
const os = __webpack_require__(87); const os = __importStar(__webpack_require__(87));
const path = __webpack_require__(622); const path = __importStar(__webpack_require__(622));
/** /**
* The code to exit an action * The code to exit an action
*/ */
@@ -4766,11 +4766,13 @@ var ExitCode;
/** /**
* Sets env variable for this action and future actions in the job * Sets env variable for this action and future actions in the job
* @param name the name of the variable to set * @param name the name of the variable to set
* @param val the value of the variable * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function exportVariable(name, val) { function exportVariable(name, val) {
process.env[name] = val; const convertedVal = command_1.toCommandValue(val);
command_1.issueCommand('set-env', { name }, val); process.env[name] = convertedVal;
command_1.issueCommand('set-env', { name }, convertedVal);
} }
exports.exportVariable = exportVariable; exports.exportVariable = exportVariable;
/** /**
@@ -4809,12 +4811,22 @@ exports.getInput = getInput;
* Sets the value of an output. * Sets the value of an output.
* *
* @param name name of the output to set * @param name name of the output to set
* @param value value to store * @param value value to store. Non-string values will be converted to a string via JSON.stringify
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setOutput(name, value) { function setOutput(name, value) {
command_1.issueCommand('set-output', { name }, value); command_1.issueCommand('set-output', { name }, value);
} }
exports.setOutput = setOutput; exports.setOutput = setOutput;
/**
* Enables or disables the echoing of commands into stdout for the rest of the step.
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
*
*/
function setCommandEcho(enabled) {
command_1.issue('echo', enabled ? 'on' : 'off');
}
exports.setCommandEcho = setCommandEcho;
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// Results // Results
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@@ -4831,6 +4843,13 @@ exports.setFailed = setFailed;
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// Logging Commands // Logging Commands
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/**
* Gets whether Actions Step Debug is on or not
*/
function isDebug() {
return process.env['RUNNER_DEBUG'] === '1';
}
exports.isDebug = isDebug;
/** /**
* Writes debug message to user log * Writes debug message to user log
* @param message debug message * @param message debug message
@@ -4841,18 +4860,18 @@ function debug(message) {
exports.debug = debug; exports.debug = debug;
/** /**
* Adds an error issue * Adds an error issue
* @param message error issue message * @param message error issue message. Errors will be converted to string via toString()
*/ */
function error(message) { function error(message) {
command_1.issue('error', message); command_1.issue('error', message instanceof Error ? message.toString() : message);
} }
exports.error = error; exports.error = error;
/** /**
* Adds an warning issue * Adds an warning issue
* @param message warning issue message * @param message warning issue message. Errors will be converted to string via toString()
*/ */
function warning(message) { function warning(message) {
command_1.issue('warning', message); command_1.issue('warning', message instanceof Error ? message.toString() : message);
} }
exports.warning = warning; exports.warning = warning;
/** /**
@@ -4910,8 +4929,9 @@ exports.group = group;
* Saves state for current action, the state can only be retrieved by this action's post job execution. * Saves state for current action, the state can only be retrieved by this action's post job execution.
* *
* @param name name of the state to store * @param name name of the state to store
* @param value value to store * @param value value to store. Non-string values will be converted to a string via JSON.stringify
*/ */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function saveState(name, value) { function saveState(name, value) {
command_1.issueCommand('save-state', { name }, value); command_1.issueCommand('save-state', { name }, value);
} }
@@ -5251,6 +5271,53 @@ if (process.platform === 'linux') {
module.exports = require("util"); module.exports = require("util");
/***/ }),
/***/ 676:
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
const { inspect } = __webpack_require__(669);
const core = __webpack_require__(470);
const { request } = __webpack_require__(753);
async function run() {
try {
const inputs = {
token: core.getInput("token"),
repository: core.getInput("repository"),
eventType: core.getInput("event-type"),
clientPayload: core.getInput("client-payload")
};
core.debug(`Inputs: ${inspect(inputs)}`);
const repository = inputs.repository ? inputs.repository : process.env.GITHUB_REPOSITORY;
core.debug(`repository: ${repository}`);
const clientPayload = inputs.clientPayload ? inputs.clientPayload : '{}';
core.debug(`clientPayload: ${clientPayload}`);
await request(
`POST /repos/${repository}/dispatches`,
{
headers: {
authorization: `token ${inputs.token}`
},
mediaType: {
previews: ['everest']
},
event_type: `${inputs.eventType}`,
client_payload: JSON.parse(clientPayload),
}
);
} catch (error) {
core.debug(inspect(error));
core.setFailed(error.message);
}
}
run();
/***/ }), /***/ }),
/***/ 692: /***/ 692:
@@ -5447,7 +5514,7 @@ var isPlainObject = _interopDefault(__webpack_require__(696));
var nodeFetch = _interopDefault(__webpack_require__(454)); var nodeFetch = _interopDefault(__webpack_require__(454));
var requestError = __webpack_require__(463); var requestError = __webpack_require__(463);
const VERSION = "5.3.1"; const VERSION = "5.4.2";
function getBufferResponse(response) { function getBufferResponse(response) {
return response.arrayBuffer(); return response.arrayBuffer();
@@ -5477,7 +5544,7 @@ function fetchWrapper(requestOptions) {
if (status === 204 || status === 205) { if (status === 204 || status === 205) {
return; return;
} // GitHub API returns 200 for HEAD requsets } // GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") { if (requestOptions.method === "HEAD") {
@@ -5508,7 +5575,7 @@ function fetchWrapper(requestOptions) {
try { try {
let responseBody = JSON.parse(error.message); let responseBody = JSON.parse(error.message);
Object.assign(error, responseBody); Object.assign(error, responseBody);
let errors = responseBody.errors; // Assumption `errors` would always be in Array Fotmat let errors = responseBody.errors; // Assumption `errors` would always be in Array format
error.message = error.message + ": " + errors.map(JSON.stringify).join(", "); error.message = error.message + ": " + errors.map(JSON.stringify).join(", ");
} catch (e) {// ignore, see octokit/rest.js#684 } catch (e) {// ignore, see octokit/rest.js#684
@@ -5637,7 +5704,7 @@ function getUserAgent() {
return "Windows <version undetectable>"; return "Windows <version undetectable>";
} }
throw error; return "<environment undetectable>";
} }
} }

6357
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,11 @@
"name": "repository-dispatch", "name": "repository-dispatch",
"version": "1.0.0", "version": "1.0.0",
"description": "Create a repository dispatch event", "description": "Create a repository dispatch event",
"main": "index.js", "main": "src/index.js",
"scripts": { "scripts": {
"build": "ncc build index.js -o dist" "lint": "eslint src/index.js",
"package": "ncc build src/index.js -o dist",
"test": "eslint src/index.js && jest --passWithNoTests"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -18,10 +20,12 @@
}, },
"homepage": "https://github.com/peter-evans/repository-dispatch#readme", "homepage": "https://github.com/peter-evans/repository-dispatch#readme",
"dependencies": { "dependencies": {
"@actions/core": "^1.1.1", "@actions/core": "1.2.4",
"@octokit/request": "^5.1.0" "@octokit/request": "5.4.2"
}, },
"devDependencies": { "devDependencies": {
"@zeit/ncc": "^0.20.5" "@zeit/ncc": "0.22.1",
"eslint": "6.8.0",
"jest": "25.5.4"
} }
} }

11
renovate.json Normal file
View File

@@ -0,0 +1,11 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"depTypeList": ["devDependencies"],
"automerge": true
}
]
}