mirror of
https://github.com/zhigang1992/probot.git
synced 2026-06-15 02:18:58 +08:00
26 lines
684 B
JavaScript
Executable File
26 lines
684 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
// Usage: script/simulate issues path/to/payload
|
|
|
|
require('dotenv').config({silent: true});
|
|
|
|
const process = require('process');
|
|
const path = require('path')
|
|
|
|
const eventName = process.argv[2];
|
|
const payloadPath = process.argv[3];
|
|
|
|
if(!eventName || !payloadPath) {
|
|
console.log("Usage: script/simulate event-name path/to/payload.json");
|
|
process.exit(1);
|
|
}
|
|
|
|
// Show trace for any unhandled rejections
|
|
process.on('unhandledRejection', reason => console.error(reason));
|
|
|
|
const robot = require('../lib/robot');
|
|
const payload = require(path.join(process.cwd(), payloadPath));
|
|
|
|
console.log("Simulating event", eventName);
|
|
|
|
robot.receive({event: eventName, payload});
|