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:
@@ -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),
|
||||
})
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user