Skip to content

Commit

Permalink
Fix bypass accept_ms_testers_without_closed_task (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippeauriach authored Feb 7, 2023
1 parent e1be7a8 commit 2fa672c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ async function checkIfCanMergeWithoutAsanaTask({ repository, pullRequest }) {
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) {
Expand Down
9 changes: 7 additions & 2 deletions lib/mobsuccessyml.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
const yaml = require("js-yaml");
const { octokit } = require("./actions/octokit");
const getOctokit = require("./actions/octokit");

const octokit = getOctokit();

exports.getMobsuccessYMLFromRepo = async function getMobsuccessYMLFromRepo({
owner,
repo,
branch,
}) {
try {
const { data } = await octokit.rest.repos.getContent({
const { data } = await octokit.repos.getContent({
owner,
repo,
path: ".mobsuccess.yml",
ref: branch || "master",
});
const content = Buffer.from(data.content, "base64").toString("utf8");
return yaml.load(content);
} catch (e) {
console.log("Error getting .mobsuccess.yml from repo", e);
return {};
}
};

0 comments on commit 2fa672c

Please sign in to comment.