diff --git a/action.js b/action.js index b76d4e611..9990540b6 100644 --- a/action.js +++ b/action.js @@ -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) { diff --git a/lib/mobsuccessyml.js b/lib/mobsuccessyml.js index ccffe64e4..49be5ae46 100644 --- a/lib/mobsuccessyml.js +++ b/lib/mobsuccessyml.js @@ -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 {}; } };