mirror of
https://github.com/peter-evans/repository-dispatch.git
synced 2026-06-11 11:21:25 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce5485de42 | ||
|
|
eed51ed4c3 | ||
|
|
938c2224dd | ||
|
|
d1b7bfe3a6 | ||
|
|
8031fbaca8 | ||
|
|
f1680f525a | ||
|
|
5fda2f7d98 | ||
|
|
031f27b115 | ||
|
|
c49e1666ac | ||
|
|
111788c696 | ||
|
|
f131b1d1f9 | ||
|
|
1b0d3fa47b | ||
|
|
6de120f0ca | ||
|
|
1f8e017ab8 |
@@ -107,6 +107,8 @@ The following payload will succeed.
|
||||
client-payload: '{"github": ${{ toJson(github) }}}'
|
||||
```
|
||||
|
||||
Additionally, there is a limitation on the total data size of the `client-payload`. A very large payload may result in a `client_payload is too large` error.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
110
dist/index.js
vendored
110
dist/index.js
vendored
@@ -60,7 +60,12 @@ function run() {
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(util_1.inspect(error));
|
||||
core.setFailed(error.message);
|
||||
if (error.status == 404) {
|
||||
core.setFailed('Repository not found, OR token has insufficient permissions.');
|
||||
}
|
||||
else {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -83,6 +88,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const os = __importStar(__webpack_require__(2087));
|
||||
const utils_1 = __webpack_require__(5278);
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@@ -136,28 +142,14 @@ class Command {
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
function escapeData(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
@@ -191,6 +183,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const command_1 = __webpack_require__(7351);
|
||||
const file_command_1 = __webpack_require__(717);
|
||||
const utils_1 = __webpack_require__(5278);
|
||||
const os = __importStar(__webpack_require__(2087));
|
||||
const path = __importStar(__webpack_require__(5622));
|
||||
/**
|
||||
@@ -217,9 +211,17 @@ var ExitCode;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = command_1.toCommandValue(val);
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@@ -235,7 +237,13 @@ exports.setSecret = setSecret;
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
@@ -397,6 +405,68 @@ exports.getState = getState;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 717:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// For internal use, subject to change.
|
||||
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 }));
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__webpack_require__(5747));
|
||||
const os = __importStar(__webpack_require__(2087));
|
||||
const utils_1 = __webpack_require__(5278);
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5278:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4087:
|
||||
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
||||
|
||||
|
||||
2329
package-lock.json
generated
2329
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
20
package.json
20
package.json
@@ -27,22 +27,22 @@
|
||||
},
|
||||
"homepage": "https://github.com/peter-evans/repository-dispatch#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "1.2.5",
|
||||
"@actions/core": "1.2.6",
|
||||
"@actions/github": "4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "26.0.14",
|
||||
"@types/node": "14.10.3",
|
||||
"@typescript-eslint/parser": "4.1.1",
|
||||
"@types/jest": "26.0.15",
|
||||
"@types/node": "14.14.6",
|
||||
"@typescript-eslint/parser": "4.6.1",
|
||||
"@vercel/ncc": "0.24.1",
|
||||
"eslint": "7.9.0",
|
||||
"eslint": "7.12.1",
|
||||
"eslint-plugin-github": "4.1.1",
|
||||
"eslint-plugin-jest": "24.0.1",
|
||||
"jest": "26.4.2",
|
||||
"jest-circus": "26.4.2",
|
||||
"eslint-plugin-jest": "24.1.0",
|
||||
"jest": "26.6.3",
|
||||
"jest-circus": "26.6.3",
|
||||
"js-yaml": "3.14.0",
|
||||
"prettier": "2.1.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"typescript": "4.0.2"
|
||||
"ts-jest": "26.4.3",
|
||||
"typescript": "4.0.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,13 @@ async function run(): Promise<void> {
|
||||
})
|
||||
} catch (error) {
|
||||
core.debug(inspect(error))
|
||||
core.setFailed(error.message)
|
||||
if (error.status == 404) {
|
||||
core.setFailed(
|
||||
'Repository not found, OR token has insufficient permissions.'
|
||||
)
|
||||
} else {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user