Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
add bailing out for unsupported action/event combo
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Henry committed Feb 23, 2020
1 parent 32f370e commit 3bad8b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const core = require('@actions/core');
const github = require('@actions/github');
const axios = require('axios');

const supportedEvent = 'pull_request';
const supportedActions = ['opened', 'reopened', 'edited'];

//configured in workflow file, which in turn should use repo secrets settings
const trelloKey = core.getInput('trello-key');
const trelloToken = core.getInput('trello-token');
Expand Down Expand Up @@ -102,6 +105,11 @@ const buildTrelloLinkComment = async (cardId) => {

(async () => {
try {
if(!(evthookPayload.eventName === supportedEvent && supportedActions.some(el => el === evthookPayload.action))) {
console.log(`event/type not supported: ${evthookPayload.eventName}.${evthookPayload.action}. skipping action.`);
return;
}

const cardId = extractTrelloCardId(evthookPayload.pull_request.body);
const prUrl = evthookPayload.pull_request.html_url;

Expand Down

0 comments on commit 3bad8b4

Please sign in to comment.