Skip to content

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Mar 7, 2020
1 parent 39c5663 commit 05b8d60
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ export async function run(): Promise<void> {

console.log(context);

const action = context.payload.action;
const event = context.payload.action;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const labelName = (context.payload as any).label.name;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const issueNumber = (context.payload as any).issue.number;
core.info(`\
[INFO] config_file: ${inps.ConfigFilePath}
[INFO] labelName: ${labelName}
[INFO] action: ${action}
[INFO] event: ${event}
[INFO] issueNumber: ${issueNumber}\
`);

Expand All @@ -54,10 +54,14 @@ export async function run(): Promise<void> {
console.log(config);
let commentBody = '';
let finalAction = '';
Object.keys(config[`${action}`]).forEach(label => {
if (config[`${action}`][label].name === labelName) {
commentBody = config[`${action}`][label].body;
finalAction = config[`${action}`][label].action;
if (config[`${event}`] === void 0) {
core.info(`no configuration for ${event} ${labelName}`);
return;
}
Object.keys(config[`${event}`]).forEach(label => {
if (config[`${event}`][label].name === labelName) {
commentBody = config[`${event}`][label].body;
finalAction = config[`${event}`][label].action;
}
});
core.info(`\
Expand Down

0 comments on commit 05b8d60

Please sign in to comment.