Skip to content

Commit

Permalink
fix(publish): set default repository from ctx.options.repositoryUrl
Browse files Browse the repository at this point in the history
refs #270
  • Loading branch information
lgaticaq committed Sep 9, 2020
1 parent 82b5677 commit 7481aad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
| `project` | The slug of the project. Optional. Required if not present in environment variables |
| `org` | The slug of the organization. Optional. Required if not present in environment variables |
| `url` | The URL to use to connect to sentry. Optional to set an on-premise instance |
| `repositoryUrl` | A valid repository name for add link to commits of new release. Optional. Ex: 'myorg / myapp' |
| `repositoryUrl` | A valid repository name for add link to commits of new release. Optional. Ex: 'myorg / myapp'. Default repository property in package.json, or git origin url. |
| `tagsUrl` | A valid url for add link to new release. Optional. Ex: https://github.com/owner/repo/releases/tag/vx.y.z |
| `environment` | Sentry environment. Optional for deploy. Default production |
| `deployName` | Deploy name. Optional for deploy |
Expand Down
6 changes: 2 additions & 4 deletions src/parse-commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ const parseCommits = async (pluginConfig, ctx) => {
message: commit.message,
author_name: commit.author.name,
author_email: commit.author.email,
timestamp: commit.committerDate
}
if (pluginConfig.repositoryUrl) {
releaseCommit.repository = pluginConfig.repositoryUrl
timestamp: commit.committerDate,
repository: pluginConfig.repositoryUrl || ctx.options.repositoryUrl
}
releaseCommit.patch_set = await getCommitPatchSet(ctx.cwd, releaseCommit.id)
commits.push(releaseCommit)
Expand Down
27 changes: 23 additions & 4 deletions test/publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mock('git-diff-tree', gitDiffTree)
const publish = require('../src/publish')

describe('Publish', () => {
/** @type {import('../src/types').Context} */
const ctx = {
env: {
SENTRY_ORG: 'valid',
Expand All @@ -41,12 +42,30 @@ describe('Publish', () => {
{
hash: 'bb3dedcb1fbbd8ffa8fc75d082ea91340a4c7aa7',
message: 'fix(js): fix request',
author: { name: 'me', email: 'me@me.me' },
committerDate: new Date().toISOString()
author: { name: 'me', email: 'me@me.me', short: '' },
committerDate: new Date().toISOString(),
commit: { long: '', short: '' },
tree: { long: '', short: '' },
body: '',
committer: { name: 'me', email: 'me@me.me', short: '' },
subject: ''
}
],
nextRelease: { version: '1.0.0', gitTag: 'v1.0.0' },
logger: { log: () => ({}), error: () => ({}) }
nextRelease: {
version: '1.0.0',
gitTag: 'v1.0.0',
type: 'major',
gitHead: '',
notes: ''
},
logger: { log: () => ({}), error: () => ({}) },
options: {
repositoryUrl:
'https://github.com/eclass/semantic-release-sentry-releases.git',
branches: '',
plugins: [],
tagFormat: ''
}
}
const SENTRY_HOST = 'https://sentry.io'
const tagsUrl = 'https://myreleases/'
Expand Down

0 comments on commit 7481aad

Please sign in to comment.