Skip to content

Commit

Permalink
Update the action JS
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Aug 13, 2020
1 parent d77c91c commit 5402243
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ const Codeowners = require('codeowners');

// Effectively the main function
async function run() {
console.log("Starting with ", context)

// Tell folks they can merge
if (context.action === "pull_request_target") {
if (context.eventName === "pull_request_target") {
commentOnMergablePRs()
}

// Merge if they say they have access
if (context.action === "issue_comment") {
if (context.eventName === "issue_comment") {
mergeIfLGTMAndHasAccess()
}
}

async function commentOnMergablePRs() {
if (context.action !== "pull_request_target") {
if (context.eventName !== "pull_request_target") {
throw new Error("This function can only run when the workflow specifies `pull_request_target` in the `on:`.")
}

Expand Down

0 comments on commit 5402243

Please sign in to comment.