Skip to content

Commit

Permalink
Add merge group support (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach committed Mar 1, 2023
1 parent 2da236b commit 571d188
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions action.js
Expand Up @@ -22,14 +22,21 @@ async function getActionParameters() {
} = github.context.payload;
console.log(`Found issue ${issueNumber} for ${owner}/${repo}`);
return { comment, owner, repo, issueNumber };
} else {
} else if (github.context.payload.pull_request) {
// this is a PR event
console.log("Getting PR from context");
const pullRequest = github.context.payload.pull_request;
return {
pullRequest,
};
} else if (github.context.payload.merge_group) {
// this is a merge group event
const { merge_group: mergeGroup } = github.context.payload;
return {
mergeGroup,
};
}
return {};
}

const getPullAuthor = (exports.getPullAuthor = (pullRequest) => {
Expand Down Expand Up @@ -84,8 +91,10 @@ exports.action = async function action() {
github.context.payload.issue.number
) {
return await actionIssue();
} else {
} else if (github.context.payload.pull_request) {
return await actionPullRequest();
} else {
console.log("Not an issue neither a pull request, ignoring");
}
};

Expand Down
4 changes: 4 additions & 0 deletions sample/workflows/review.yml
@@ -1,6 +1,10 @@
name: Review Requested

on:
merge_group:
types:
- checks_requested

pull_request:
types:
- assigned
Expand Down

0 comments on commit 571d188

Please sign in to comment.