auto-detect default branch on [github nycrc osslifecycle] (#5234)

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
chris48s
2020-06-25 21:15:20 +01:00
committed by GitHub
parent 9acc305d31
commit 270c29f757
7 changed files with 11 additions and 11 deletions

View File

@@ -164,7 +164,7 @@ module.exports = class GithubCommitsSince extends GithubAuthV3Service {
: 'repo or version not found'
const { ahead_by: commitCount } = await this._requestJson({
schema,
url: `/repos/${user}/${repo}/compare/${version}...${branch || 'master'}`,
url: `/repos/${user}/${repo}/compare/${version}...${branch || 'HEAD'}`,
errorMessages: errorMessagesFor(notFoundMessage),
})

View File

@@ -26,7 +26,7 @@ const contentSchema = Joi.object({
async function fetchRepoContent(
serviceInstance,
{ user, repo, branch = 'master', filename }
{ user, repo, branch = 'HEAD', filename }
) {
const errorMessages = errorMessagesFor(
`repo not found, branch not found, or ${filename} missing`

View File

@@ -166,7 +166,7 @@ class GithubPackageJsonDependencyVersion extends ConditionalGithubAuthV3Service
}
async handle(
{ user, repo, kind, branch = 'master', scope, packageName },
{ user, repo, kind, branch = 'HEAD', scope, packageName },
{ filename = 'package.json' }
) {
const {

View File

@@ -114,7 +114,7 @@ module.exports = class Nycrc extends ConditionalGithubAuthV3Service {
schema: pkgJSONSchema,
user,
repo,
branch: 'master',
branch: 'HEAD',
filename: config,
})
const nycConfig = pkgJson.c8 || pkgJson.nyc
@@ -131,7 +131,7 @@ module.exports = class Nycrc extends ConditionalGithubAuthV3Service {
schema: nycrcSchema,
user,
repo,
branch: 'master',
branch: 'HEAD',
filename: config,
}),
preferredThreshold

View File

@@ -26,7 +26,7 @@ t.create('.nycrc in monorepo')
.get('/yargs/yargs.json?config=packages/foo/.nycrc.json')
.intercept(nock =>
nock('https://api.github.com')
.get('/repos/yargs/yargs/contents/packages/foo/.nycrc.json?ref=master')
.get('/repos/yargs/yargs/contents/packages/foo/.nycrc.json?ref=HEAD')
.reply(200, {
content: Buffer.from(
JSON.stringify({
@@ -42,7 +42,7 @@ t.create('.nycrc with no thresholds')
.get('/yargs/yargs.json?config=.nycrc')
.intercept(nock =>
nock('https://api.github.com')
.get('/repos/yargs/yargs/contents/.nycrc?ref=master')
.get('/repos/yargs/yargs/contents/.nycrc?ref=HEAD')
.reply(200, {
content: Buffer.from(
JSON.stringify({
@@ -61,7 +61,7 @@ t.create('package.json with nyc stanza')
.get('/yargs/yargs.json?config=package.json')
.intercept(nock =>
nock('https://api.github.com')
.get('/repos/yargs/yargs/contents/package.json?ref=master')
.get('/repos/yargs/yargs/contents/package.json?ref=HEAD')
.reply(200, {
content: Buffer.from(
JSON.stringify({
@@ -79,7 +79,7 @@ t.create('package.json with nyc stanza, but no thresholds')
.get('/yargs/yargs.json?config=package.json')
.intercept(nock =>
nock('https://api.github.com')
.get('/repos/yargs/yargs/contents/package.json?ref=master')
.get('/repos/yargs/yargs/contents/package.json?ref=HEAD')
.reply(200, {
content: Buffer.from(
JSON.stringify({

View File

@@ -93,7 +93,7 @@ module.exports = class OssTracker extends BaseService {
const { buffer } = await this.fetch({
user,
repo,
branch: branch || 'master',
branch: branch || 'HEAD',
})
try {
const status = buffer.match(/osslifecycle=([a-z]+)/im)[1]

View File

@@ -47,7 +47,7 @@ t.create('oss metadata in unexpected format')
.intercept(
nock =>
nock('https://raw.githubusercontent.com')
.get('/some-user/some-project/master/OSSMETADATA')
.get('/some-user/some-project/HEAD/OSSMETADATA')
.reply(200, `wrongkey=active`),
{
'Content-Type': 'text/plain;charset=UTF-8',