Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subdirectory pull requests from dependabot #61

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/checkTargetMatchToPR.js
Expand Up @@ -3,7 +3,7 @@ const semverDiff = require('semver/functions/diff')

const { semanticVersionOrder } = require('./getTargetInput')

const expression = /from ([^\s]+) to (.+)$/
const expression = /from ([^\s]+) to ([^\s]+)/

const checkTargetMatchToPR = (prTitle, target) => {
const match = expression.exec(prTitle)
Expand Down
4 changes: 4 additions & 0 deletions test/checkTargetMatchToPR.test.js
Expand Up @@ -17,12 +17,16 @@ const preReleaseUpgradePRTitle =
const preReleaseToPathUpgradePRTitle =
'chore(deps-dev): bump fastify from 3.18.0-alpha to 3.18.2'
const sameVersion = 'chore(deps-dev): bump fastify from 3.18.0 to 3.18.0'
const patchPRTitleInSubDirectory = 'chore(deps-dev): bump fastify from 3.18.0 to 3.18.1 in /packages/a'

tap.test('checkTargetMatchToPR', async t => {
t.test('should return true when target is major', async t => {
t.test('and PR is patch', async t => {
t.ok(checkTargetMatchToPR(patchPRTitle, targetOptions.major))
})
t.test('and PR is patch in a subdirectory', async t => {
t.ok(checkTargetMatchToPR(patchPRTitleInSubDirectory, targetOptions.major))
})
t.test('and PR is patch with pre-release version', async t => {
t.ok(checkTargetMatchToPR(preReleaseUpgradePRTitle, targetOptions.major))
})
Expand Down