Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: semantic-release/github
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.2.10
Choose a base ref
...
head repository: semantic-release/github
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.11
Choose a head ref
  • 2 commits
  • 8 files changed
  • 1 contributor

Commits on Jan 22, 2019

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f1fedc0 View commit details

Commits on Mar 11, 2019

  1. Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    552b131 View commit details
Showing with 12 additions and 8 deletions.
  1. +3 −0 index.js
  2. +1 −2 lib/definitions/errors.js
  3. +3 −2 lib/get-client.js
  4. +1 −0 lib/get-search-queries.js
  5. +1 −0 lib/glob-assets.js
  6. +1 −0 lib/publish.js
  7. +2 −2 package.json
  8. +0 −2 test/get-client.test.js
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ async function publish(pluginConfig, context) {
await verifyGitHub(pluginConfig, context);
verified = true;
}

return publishGitHub(pluginConfig, context);
}

@@ -38,6 +39,7 @@ async function success(pluginConfig, context) {
await verifyGitHub(pluginConfig, context);
verified = true;
}

await successGitHub(pluginConfig, context);
}

@@ -46,6 +48,7 @@ async function fail(pluginConfig, context) {
await verifyGitHub(pluginConfig, context);
verified = true;
}

await failGitHub(pluginConfig, context);
}

3 changes: 1 addition & 2 deletions lib/definitions/errors.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const url = require('url');
const {inspect} = require('util');
const {isString} = require('lodash');
const pkg = require('../../package.json');

const homepage = url.format({...url.parse(pkg.homepage), ...{hash: null}});
const [homepage] = pkg.homepage.split('#');
const stringify = obj => (isString(obj) ? obj : inspect(obj, {breakLength: Infinity, depth: 2, maxArrayLength: 5}));
const linkify = file => `${homepage}/blob/master/${file}`;

5 changes: 3 additions & 2 deletions lib/get-client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const url = require('url');
const {URL} = require('url');
const {memoize, get} = require('lodash');
const Octokit = require('@octokit/rest');
const pRetry = require('p-retry');
@@ -35,7 +35,7 @@ module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
baseUrl,
request: {
agent: proxy
? baseUrl && url.parse(baseUrl).protocol.replace(':', '') === 'http'
? baseUrl && new URL(baseUrl).protocol.replace(':', '') === 'http'
? new HttpProxyAgent(proxy)
: new HttpsProxyAgent(proxy)
: undefined,
@@ -54,6 +54,7 @@ module.exports = ({githubToken, githubUrl, githubApiPathPrefix, proxy}) => {
if (SKIP_RETRY_CODES.includes(error.status)) {
throw new pRetry.AbortError(error);
}

throw error;
}
}, RETRY_CONF);
1 change: 1 addition & 0 deletions lib/get-search-queries.js
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ module.exports = (base, commits, separator = '+') => {
} else {
searches.push(`${base}${separator}${commit}`);
}

return searches;
}, []);
};
1 change: 1 addition & 0 deletions lib/glob-assets.js
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ module.exports = async ({cwd}, assets) =>
// - other properties of the original asset definition
return globbed.map(file => ({...asset, path: file, name: basename(file)}));
}

// If asset is an Object, output an Object definition with:
// - `path` of the matched file if there is one, or the original `path` definition (will be considered as a missing file)
// - other properties of the original asset definition
1 change: 1 addition & 0 deletions lib/publish.js
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ module.exports = async (pluginConfig, context) => {
logger.error('The asset %s cannot be read, and will be ignored.', filePath);
return;
}

if (!file || !file.isFile()) {
logger.error('The asset %s is not a file, and will be ignored.', filePath);
return;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
"lodash": "^4.17.4",
"mime": "^2.0.3",
"p-filter": "^1.0.0",
"p-retry": "^3.0.0",
"p-retry": "^4.0.0",
"parse-github-url": "^1.0.1",
"url-join": "^4.0.0"
},
@@ -48,7 +48,7 @@
"server-destroy": "^1.0.1",
"sinon": "^7.1.1",
"tempy": "^0.2.1",
"xo": "^0.23.0"
"xo": "^0.24.0"
},
"engines": {
"node": ">=8.3"
2 changes: 0 additions & 2 deletions test/get-client.test.js
Original file line number Diff line number Diff line change
@@ -170,8 +170,6 @@ test('Use different throttler for read and write endpoints', async t => {

test('Use the same throttler when retrying', async t => {
const coreRate = 200;

// eslint-disable-next-line require-await
const request = stub().callsFake(async () => {
const err = new Error();
err.time = Date.now();