mirror of
https://github.com/peter-evans/repository-dispatch.git
synced 2026-07-02 08:58:42 +00:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1daf2a5ee | ||
|
|
2c6e6ad52e | ||
|
|
ac04beb74d | ||
|
|
4c932e5fcf | ||
|
|
c3983458b8 | ||
|
|
0273c20a19 | ||
|
|
c18d89812d | ||
|
|
87c9d703ce | ||
|
|
79ebb27197 | ||
|
|
070f6e1940 | ||
|
|
80521239f3 | ||
|
|
22b027c6f6 | ||
|
|
aa63154642 | ||
|
|
fa5ce5b708 | ||
|
|
0aa5a24ce3 | ||
|
|
22de67cbcd | ||
|
|
1e4d1b6ee6 | ||
|
|
30e4e3c61c | ||
|
|
8b55117fd3 | ||
|
|
cee9e0a8c3 | ||
|
|
969582a5eb | ||
|
|
c8b367eb2d | ||
|
|
dd94f75873 | ||
|
|
23c9cd4b68 | ||
|
|
bd127af08d | ||
|
|
ee6a038929 | ||
|
|
aaad5096a7 | ||
|
|
6f1fae5558 | ||
|
|
72ff22d22a | ||
|
|
01c2a6f449 | ||
|
|
5e5f450278 |
17
.eslintrc.json
Normal file
17
.eslintrc.json
Normal 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
67
.github/workflows/ci.yml
vendored
Normal 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
|
||||||
13
.github/workflows/create-repository-dispatch.yml
vendored
13
.github/workflows/create-repository-dispatch.yml
vendored
@@ -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 }}"}'
|
|
||||||
4
.github/workflows/on-repository-dispatch.yml
vendored
4
.github/workflows/on-repository-dispatch.yml
vendored
@@ -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 }}
|
||||||
|
|||||||
33
README.md
33
README.md
@@ -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
243
dist/index.js
vendored
@@ -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
6357
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -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
11
renovate.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"depTypeList": ["devDependencies"],
|
||||||
|
"automerge": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user