Description
Environment
Node: 20.16.0
NPM: 10.8.1
Changelogen: 0.6.1
Environment: Docker Ubuntu
Reproduction
Repoduction Steps
- In
package.json
, provide subgroup repository shortcut syntax
{
"repository": "gitlab:group/subgroup-a/subgroup-a1/repo.git"
}
- Run
npx changelogen
and check the generated changelog
Expectation
It should generate changelog with link to commit.
## ...main
### 🤖 CI
- Added changelogen ([7b0990a](https://gitlab.com/group/subgroup-a/subgroup-a1/repo/commit/7b0990a))
### ❤️ Contributors
- Wuiyang Tan <[email protected]>
Actual result
The generated changelog did not includes link to commit.
## ...main
### 🤖 CI
- Added changelogen (7b0990a)
### ❤️ Contributors
- Wuiyang Tan <[email protected]>
More Information
I just tried with normal git repo link without shortcut syntax (https://gitlab.com/group/subgroup-a/subgroup-a1/repo
), it work as expected.
Describe the bug
In repo with package.json
using repository shortcut syntax, it cannot handle subgroup repository link correctly (gitlab:group/subgroup-a/subgroup-a1/repo.git
)
The current regex for picking up the repository shortcut syntax only supports format [provider]:[owner]/[repo-name](.git)?
without extra /
in repo-name
.
I believe updating the regex to accept optional /
in repo-name
section should be sufficient in picking up subgroups (and nested subgroups) repository.
// https://regex101.com/r/NA4Io6/1
const providerURLRegex =
- /^(?:(?<user>[\w-]+)@)?(?:(?<provider>[^/:]+):)?(?<repo>[\w-]+\/(?:\w|\.(?!git$)|-)+)(?:\.git)?$/;
+ /^(?:(?<user>[\w-]+)@)?(?:(?<provider>[^/:]+):)?(?<repo>[\w-]+\/(?:\/?\w|\.(?!git$)|-)+)(?:\.git)?$/;
Included regex101 link for testing: https://regex101.com/r/Cmuakg/1
Additional context
No response