@semantic-release/github
Advanced tools
Comparing version 2.2.1 to 2.2.2
@@ -6,3 +6,3 @@ const verifyGithub = require('./lib/verify'); | ||
async function verifyConditions(pluginConfig, {options}) { | ||
async function verifyConditions(pluginConfig, {options, logger}) { | ||
// If the Github publish plugin is used and has `assets` configured, validate it now in order to prevent any release if the configuration is wrong | ||
@@ -18,3 +18,3 @@ if (options.publish) { | ||
await verifyGithub(pluginConfig, options); | ||
await verifyGithub(pluginConfig, options, logger); | ||
verified = true; | ||
@@ -25,3 +25,3 @@ } | ||
if (!verified) { | ||
await verifyGithub(pluginConfig, options); | ||
await verifyGithub(pluginConfig, options, logger); | ||
verified = true; | ||
@@ -28,0 +28,0 @@ } |
const {basename, extname} = require('path'); | ||
const {parse} = require('url'); | ||
const {stat, readFile} = require('fs-extra'); | ||
const {isPlainObject} = require('lodash'); | ||
const parseGithubUrl = require('parse-github-url'); | ||
const GitHubApi = require('github'); | ||
const pReduce = require('p-reduce'); | ||
@@ -12,2 +10,3 @@ const mime = require('mime'); | ||
const resolveConfig = require('./resolve-config'); | ||
const getClient = require('./get-client'); | ||
@@ -17,9 +16,5 @@ module.exports = async (pluginConfig, {branch, repositoryUrl}, {version, gitHead, gitTag, notes}, logger) => { | ||
const {name: repo, owner} = parseGithubUrl(repositoryUrl); | ||
let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; | ||
protocol = (protocol || '').split(':')[0] || null; | ||
const github = getClient(githubToken, githubUrl, githubApiPathPrefix); | ||
const release = {owner, repo, tag_name: gitTag, name: gitTag, target_commitish: branch, body: notes}; // eslint-disable-line camelcase | ||
const github = new GitHubApi({port, protocol, host, pathPrefix: githubApiPathPrefix}); | ||
github.authenticate({type: 'token', token: githubToken}); | ||
const release = {owner, repo, tag_name: gitTag, name: gitTag, target_commitish: branch, body: notes}; // eslint-disable-line camelcase | ||
debug('release owner: %o', owner); | ||
@@ -29,2 +24,3 @@ debug('release repo: %o', repo); | ||
debug('release branch: %o', branch); | ||
const ref = `refs/tags/${gitTag}`; | ||
@@ -31,0 +27,0 @@ |
@@ -1,9 +0,9 @@ | ||
const {parse} = require('url'); | ||
const url = require('url'); | ||
const {isString, isPlainObject, isUndefined, isArray} = require('lodash'); | ||
const parseGithubUrl = require('parse-github-url'); | ||
const GitHubApi = require('github'); | ||
const SemanticReleaseError = require('@semantic-release/error'); | ||
const resolveConfig = require('./resolve-config'); | ||
const getClient = require('./get-client'); | ||
module.exports = async (pluginConfig, {repositoryUrl}) => { | ||
module.exports = async (pluginConfig, {repositoryUrl}, logger) => { | ||
const {githubToken, githubUrl, githubApiPathPrefix, assets} = resolveConfig(pluginConfig); | ||
@@ -37,9 +37,11 @@ | ||
let {port, protocol, hostname: host} = githubUrl ? parse(githubUrl) : {}; | ||
protocol = (protocol || '').split(':')[0] || null; | ||
if (githubUrl) { | ||
logger.log('Verify Github authentication (%s)', url.resolve(githubUrl, githubApiPathPrefix)); | ||
} else { | ||
logger.log('Verify Github authentication'); | ||
} | ||
const github = new GitHubApi({port, protocol, host, pathPrefix: githubApiPathPrefix}); | ||
github.authenticate({type: 'token', token: githubToken}); | ||
const github = getClient(githubToken, githubUrl, githubApiPathPrefix); | ||
let push; | ||
let push; | ||
try { | ||
@@ -46,0 +48,0 @@ ({data: {permissions: {push}}} = await github.repos.get({repo, owner})); |
@@ -1,1 +0,1 @@ | ||
{"name":"@semantic-release/github","description":"Set of semantic-release plugins for publishing a Github release","version":"2.2.1","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/github/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","debug":"^3.1.0","fs-extra":"^5.0.0","github":"^13.0.0","globby":"^7.1.1","lodash":"^4.17.4","mime":"^2.0.3","p-reduce":"^1.0.0","parse-github-url":"^1.0.1"},"devDependencies":{"ava":"^0.24.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint-config-prettier":"^2.8.0","eslint-plugin-prettier":"^2.3.0","nock":"^9.1.0","nyc":"^11.2.1","prettier":"~1.9.0","semantic-release":"^10.0.0","sinon":"^4.0.0","xo":"^0.18.2"},"engines":{"node":">=4"},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/github#readme","keywords":["git","github","publish","release","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/github.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}} | ||
{"name":"@semantic-release/github","description":"Set of semantic-release plugins for publishing a Github release","version":"2.2.2","author":"Pierre Vanduynslager (https://twitter.com/@pvdlg_)","bugs":{"url":"https://github.com/semantic-release/github/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"contributors":["Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","Gregor Martynus (https://twitter.com/gr2m)"],"dependencies":{"@semantic-release/error":"^2.1.0","debug":"^3.1.0","fs-extra":"^5.0.0","github":"^13.0.0","globby":"^7.1.1","lodash":"^4.17.4","mime":"^2.0.3","p-reduce":"^1.0.0","parse-github-url":"^1.0.1"},"devDependencies":{"ava":"^0.24.0","clear-module":"^2.1.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint-config-prettier":"^2.8.0","eslint-plugin-prettier":"^2.3.0","nock":"^9.1.0","nyc":"^11.2.1","prettier":"~1.9.2","semantic-release":"^10.0.0","sinon":"^4.0.0","tempy":"^0.2.1","xo":"^0.18.2"},"engines":{"node":">=4"},"files":["lib","index.js"],"homepage":"https://github.com/semantic-release/github#readme","keywords":["git","github","publish","release","semantic-release","version"],"license":"MIT","main":"index.js","nyc":{"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/github.git"},"scripts":{"cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"xo","pretest":"npm run lint","semantic-release":"semantic-release","test":"nyc ava -v"},"xo":{"extends":["prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}}} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18788
9
221
14