Skip to content

Commit

Permalink
Merge pull request #52 from MoLow/fix-mono-repo-with-dot
Browse files Browse the repository at this point in the history
Support monorepo with a dot in its name - not starting with a dot
  • Loading branch information
adamzolyak authored Dec 12, 2022
2 parents f837019 + 527a3e6 commit c84e955
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports.listFiles = async function (octokit, eventOwner, eventRepo, event
}

module.exports.getMonorepo = function (baseDirectories, filePath) {
const regexPattern = `^${baseDirectories}([^./]*)/`
const regexPattern = `^${baseDirectories}(?![\.])([^/]*)/`
var regex = new RegExp(regexPattern)
var found = filePath.match(regex)

Expand Down
9 changes: 9 additions & 0 deletions tests/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ describe('getMonorepo', () => {

expect(result).toBe(false)
})

it('should return monorepo if monorepo contains a "." but does not starts with a .', async () => {
const fileName = 'www.site.com/main.workflow'
const baseDirectories = ''

const result = await helpers.getMonorepo(baseDirectories, fileName)

expect(result).toBe('www.site.com')
})
})

describe('addLabel', () => {
Expand Down

0 comments on commit c84e955

Please sign in to comment.