Skip to content

Commit

Permalink
Add merge group support (#50)
Browse files Browse the repository at this point in the history
* Add merge group support

* Return when ignoring

* trigger ci
  • Loading branch information
philippeauriach authored Mar 1, 2023
1 parent a7d0f71 commit d98002f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion action.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ exports.getActionParameters = function getActionParameters() {
const repository = github.context.payload.repository;
const ref = github.context.ref;
const pullRequest = github.context.payload.pull_request;
const mergeGroup = github.context.payload.merge_group;
const action = core.getInput("action", { required: true });
return { repository, ref, pullRequest, action };
return { repository, ref, pullRequest, action, mergeGroup };
};

exports.action = async function action() {
Expand All @@ -18,11 +19,16 @@ exports.action = async function action() {
ref,
pullRequest,
action,
mergeGroup,
} = exports.getActionParameters();

console.info(`Calling action ${action}`);
switch (action) {
case "validate-pr":
if (mergeGroup) {
console.log("Ignoring PR validation when running in merge group");
return;
}
await validatePR({ pullRequest });
break;
case "after-pr-merged":
Expand Down
4 changes: 4 additions & 0 deletions sample/workflows/mobsuccess.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Mobsuccess Compliance

on:
merge_group:
types:
- checks_requested

pull_request:
types:
- opened
Expand Down

0 comments on commit d98002f

Please sign in to comment.