Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the possibility to merge when asana ticket is not closed #72

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 1 addition & 33 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
moveTaskToProjectSection,
getProjectSections,
} = require("./lib/actions/asana");
const { getMobsuccessYMLFromRepo } = require("./lib/mobsuccessyml");

Check failure on line 10 in action.js

View workflow job for this annotation

GitHub Actions / Eslint

'getMobsuccessYMLFromRepo' is assigned a value but never used

const customFieldLive = require("./lib/asana/custom-fields/live");
const customFieldStorybook = require("./lib/asana/custom-fields/storybook");
Expand Down Expand Up @@ -317,29 +317,6 @@
}
}

async function checkIfCanMergeWithoutAsanaTask({ repository, pullRequest }) {
const { assignees } = pullRequest;
const assigneeLogins = assignees.map(({ login }) => login);
if (!assigneeLogins.some((login) => login === "ms-testers")) {
return false;
}

// if mobsuccess.yml has the `accept_ms_testers_without_closed_task` flag set to true, we can merge
const mobsuccessyml = await getMobsuccessYMLFromRepo({
owner: repository.owner.login,
repo: repository.name,
branch: pullRequest.head ? pullRequest.head.ref : "master",
});
const asanaSettings = mobsuccessyml.asana || {};
if (asanaSettings.accept_ms_testers_without_closed_task) {
console.log(
"accept_ms_testers_without_closed_task is set to true, ok to merge"
);
return true;
}
return false;
}

function getAwsAmplifyLiveUrls({ id, labels, amplifyUri }) {
if (!amplifyUri) {
return [];
Expand Down Expand Up @@ -375,7 +352,6 @@
// check if we run on a merge_group
const {
mergeGroup,
repository,
pullRequest,
action,
triggerPhrase,
Expand Down Expand Up @@ -480,15 +456,7 @@
});
console.log("Task is completed?", completed);
if (!completed) {
// check if can merge without a completed asana task
const canMergeWithoutAsanaTask = await checkIfCanMergeWithoutAsanaTask(
{ repository, pullRequest }
);
if (!canMergeWithoutAsanaTask) {
throw new Error(
"Asana task is not yet completed, blocking merge"
);
}
throw new Error("Asana task is not yet completed, blocking merge");
}
}
}
Expand Down
Loading