Skip to content

Commit

Permalink
Add support for merge group runs (#54)
Browse files Browse the repository at this point in the history
* log merge group or payload to learn more about merge group

* Ignore run if running in a merge group

* Correct usage of merge group from payload

* add merge_group in sample
  • Loading branch information
philippeauriach committed Feb 28, 2023
1 parent 2fa672c commit 98ca5ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ exports.findAsanaTaskId = function findAsanaTaskId({
exports.getActionParameters = function getActionParameters() {
const repository = github.context.payload.repository;
const pullRequest = github.context.payload.pull_request;
const mergeGroup = github.context.payload.merge_group;
const action = core.getInput("action", { required: true });
const triggerPhrase = core.getInput("trigger-phrase") || "";
const amplifyUri = core.getInput("amplify-uri") || "";
Expand All @@ -132,6 +133,7 @@ exports.getActionParameters = function getActionParameters() {
triggerPhrase,
amplifyUri,
storybookAmplifyUri,
mergeGroup,
};
};

Expand Down Expand Up @@ -338,14 +340,22 @@ async function checkIfCanMergeWithoutAsanaTask({ repository, pullRequest }) {
}

exports.action = async function action() {
// check if we run on a merge_group
const {
mergeGroup,
repository,
pullRequest,
action,
triggerPhrase,
amplifyUri,
storybookAmplifyUri,
} = exports.getActionParameters();

if (mergeGroup) {
console.log("Running on a merge group - skipping Asana integration");
return;
}

const taskId = exports.findAsanaTaskId({ triggerPhrase, pullRequest });

const asanaPRStatus = await exports.getAsanaPRStatus({
Expand Down
4 changes: 4 additions & 0 deletions sample/workflows/asana.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Asana

on:
merge_group:
types:
- checks_requested

pull_request:
types:
- assigned
Expand Down

0 comments on commit 98ca5ff

Please sign in to comment.