Skip to content

Commit

Permalink
Merge pull request #47 from pmowrer/misc-fixes
Browse files Browse the repository at this point in the history
Make compatible with semantic-release < 15.10.0
  • Loading branch information
pmowrer authored Jan 28, 2020
2 parents 651d17e + e178019 commit 8b5126e
Show file tree
Hide file tree
Showing 8 changed files with 3,474 additions and 2,340 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 8
- 10
notifications:
email: false
before_install:
Expand All @@ -9,4 +9,4 @@ before_install:
after_success:
- "[[ $TRAVIS_PULL_REQUEST != 'false' ]] && node ./bin/semantic-release-github-pr --debug"
- npx semantic-release --debug
cache: yarn
cache: yarn
2 changes: 1 addition & 1 deletion bin/semantic-release-github-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ const { getCurrentBranchName } = require('../src/git-utils');
`--extends=${plugins}`,
]);

execa('semantic-release', args, { stdio: 'inherit' });
execa('semantic-release', args, { stdio: 'inherit', preferLocal: true });
})();
35 changes: 19 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,38 @@
"scripts": {
"format": "prettier --write --single-quote --trailing-comma es5",
"format:all": "yarn format \"./**/*.js\"",
"precommit": "lint-staged",
"test": "jest"
},
"bin": "./bin/semantic-release-github-pr.js",
"license": "MIT",
"peerDependencies": {
"semantic-release": "13.4.1 - 15.6.x"
"semantic-release": "^15.7.0-15.9.x"
},
"dependencies": {
"execa": "^0.8.0",
"github": "^12.1.0",
"parse-github-url": "^1.0.1",
"ramda": "^0.25.0",
"read-pkg": "^3.0.0",
"debug": "^4.1.1",
"env-ci": "^5.0.1",
"execa": "^4.0.0",
"github": "^13.0.0",
"parse-github-url": "^1.0.2",
"ramda": "^0.26.1",
"read-pkg": "^5.2.0",
"semantic-release-plugin-decorators": "^2.0.0"
},
"devDependencies": {
"debug": "^3.1.0",
"env-ci": "^1.4.0",
"husky": "^0.14.3",
"jest": "^22.0.4",
"lint-staged": "^6.0.0",
"prettier": "^1.8.2",
"semantic-release": "^15.0.0"
"husky": "^4.2.1",
"jest": "^25.1.0",
"lint-staged": "^10.0.3",
"prettier": "^1.19.1",
"semantic-release": "15.9.x"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"yarn format",
"git add"
"yarn format"
]
}
}
4 changes: 1 addition & 3 deletions src/comment-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const create = (gitHead, packageName, gitTag = null) => {
// There isn't a built-in concept of a markdown comment.
// We interpret this format as a markdown comment: [//]: # (message)
// https://stackoverflow.com/questions/4823468/comments-in-markdown/20885980#20885980
return `[//]: # (semantic-release-github-pr ${gitHead} ${packageName} ${
gitTag
})`;
return `[//]: # (semantic-release-github-pr ${gitHead} ${packageName} ${gitTag})`;
};

const PARSE_REGEXP = /\[\/\/\]: # \(semantic-release-github-pr( [^\)]+)+\)/;
Expand Down
3 changes: 2 additions & 1 deletion src/github-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const { parse } = require('url');
*/
module.exports = (pluginConfig, context) => {
const { githubToken, githubUrl, githubApiPathPrefix } = resolveConfig(
pluginConfig, context
pluginConfig,
context
);

let { port, protocol, hostname: host } = githubUrl ? parse(githubUrl) : {};
Expand Down
4 changes: 3 additions & 1 deletion src/with-github.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const parseGithubUrl = require('parse-github-url');

const withGithub = plugin => (pluginConfig, context) => {
const github = githubInit(pluginConfig, context);
const { options: { repositoryUrl } } = context;
const {
options: { repositoryUrl },
} = context;
const { name: repo, owner } = parseGithubUrl(repositoryUrl);

return plugin(
Expand Down
5 changes: 4 additions & 1 deletion src/with-matching-pull-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ const { getCurrentBranchName } = require('./git-utils');

const withMatchingPullRequests = plugin => async (pluginConfig, context) => {
const { githubRepo } = pluginConfig;
const { nextRelease: { gitHead }, options: { branch } } = context;
const {
nextRelease: { gitHead },
options: { branch },
} = context;
const matchingPrFilter = isMatchingPullRequestFor(gitHead);
const { data: openPullRequests = [] } = await githubRepo.getAllPullRequests({
// Determine whether the user provided a custom `branch` value.
Expand Down
Loading

0 comments on commit 8b5126e

Please sign in to comment.