mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
refactor(github): remove ghe compatibility checks (#7540)
Co-authored-by: Rhys Arkins <rhys@arkins.net> Co-authored-by: Jamie Magee <JamieMagee@users.noreply.github.com>
This commit is contained in:
parent
769dede4fb
commit
8b7dbe5d33
1 changed files with 38 additions and 45 deletions
|
@ -484,13 +484,7 @@ async function getClosedPrs(): Promise<PrList> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getOpenPrs(): Promise<PrList> {
|
async function getOpenPrs(): Promise<PrList> {
|
||||||
// istanbul ignore if
|
// The graphql query is supported in the current oldest GHE version 2.19
|
||||||
if (config.isGhe) {
|
|
||||||
logger.debug(
|
|
||||||
'Skipping unsupported graphql PullRequests.mergeStateStatus query on GHE'
|
|
||||||
);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
if (!config.openPrList) {
|
if (!config.openPrList) {
|
||||||
config.openPrList = {};
|
config.openPrList = {};
|
||||||
let query;
|
let query;
|
||||||
|
@ -795,44 +789,43 @@ export async function getBranchStatus(
|
||||||
'branch status check result'
|
'branch status check result'
|
||||||
);
|
);
|
||||||
let checkRuns: { name: string; status: string; conclusion: string }[] = [];
|
let checkRuns: { name: string; status: string; conclusion: string }[] = [];
|
||||||
if (!config.isGhe) {
|
// API is supported in oldest available GHE version 2.19
|
||||||
try {
|
try {
|
||||||
const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash(
|
const checkRunsUrl = `repos/${config.repository}/commits/${escapeHash(
|
||||||
branchName
|
branchName
|
||||||
)}/check-runs`;
|
)}/check-runs`;
|
||||||
const opts = {
|
const opts = {
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/vnd.github.antiope-preview+json',
|
accept: 'application/vnd.github.antiope-preview+json',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const checkRunsRaw = (
|
const checkRunsRaw = (
|
||||||
await githubApi.getJson<{
|
await githubApi.getJson<{
|
||||||
check_runs: { name: string; status: string; conclusion: string }[];
|
check_runs: { name: string; status: string; conclusion: string }[];
|
||||||
}>(checkRunsUrl, opts)
|
}>(checkRunsUrl, opts)
|
||||||
).body;
|
).body;
|
||||||
if (checkRunsRaw.check_runs?.length) {
|
if (checkRunsRaw.check_runs?.length) {
|
||||||
checkRuns = checkRunsRaw.check_runs.map((run) => ({
|
checkRuns = checkRunsRaw.check_runs.map((run) => ({
|
||||||
name: run.name,
|
name: run.name,
|
||||||
status: run.status,
|
status: run.status,
|
||||||
conclusion: run.conclusion,
|
conclusion: run.conclusion,
|
||||||
}));
|
}));
|
||||||
logger.debug({ checkRuns }, 'check runs result');
|
logger.debug({ checkRuns }, 'check runs result');
|
||||||
} else {
|
} else {
|
||||||
// istanbul ignore next
|
// istanbul ignore next
|
||||||
logger.debug({ result: checkRunsRaw }, 'No check runs found');
|
logger.debug({ result: checkRunsRaw }, 'No check runs found');
|
||||||
}
|
}
|
||||||
} catch (err) /* istanbul ignore next */ {
|
} catch (err) /* istanbul ignore next */ {
|
||||||
if (err instanceof ExternalHostError) {
|
if (err instanceof ExternalHostError) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
err.statusCode === 403 ||
|
err.statusCode === 403 ||
|
||||||
err.message === PLATFORM_INTEGRATION_UNAUTHORIZED
|
err.message === PLATFORM_INTEGRATION_UNAUTHORIZED
|
||||||
) {
|
) {
|
||||||
logger.debug('No permission to view check runs');
|
logger.debug('No permission to view check runs');
|
||||||
} else {
|
} else {
|
||||||
logger.warn({ err }, 'Error retrieving check runs');
|
logger.warn({ err }, 'Error retrieving check runs');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (checkRuns.length === 0) {
|
if (checkRuns.length === 0) {
|
||||||
|
|
Loading…
Reference in a new issue