fix: support pull-request for slug and slug url

This commit is contained in:
rlespinasse
2021-01-25 22:03:30 +01:00
committed by Romain Lespinasse
parent 75ce03b6a0
commit 78985f84ec
5 changed files with 11 additions and 3 deletions

View File

@@ -43,3 +43,7 @@ test('slug_ref: a very long name', () => {
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
)
})
test('slug_ref: on pull-request ref', () => {
test_slug_ref('refs/pull/branch', 'branch')
})

View File

@@ -43,3 +43,7 @@ test('slug_url_ref: test trailing', () => {
test('slug_url_ref: test trailing with dot', () => {
test_slug_url_ref('refs/heads/.an-awesome-Feature.', 'an-awesome-feature')
})
test('slug_url_ref: on pull-request ref', () => {
test_slug_url_ref('refs/pull/branch', 'branch')
})

2
dist/index.js vendored
View File

@@ -720,7 +720,7 @@ function replaceAnyDotToHyphen(envVar) {
return envVar.replace(RegExp('[.]', 'g'), '-');
}
function removeRef(envVar) {
return envVar.replace(RegExp('^refs/(heads|tags)/'), '');
return envVar.replace(RegExp('^refs/(heads|tags|pull)/'), '');
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -65,5 +65,5 @@ function replaceAnyDotToHyphen(envVar: string): string {
}
function removeRef(envVar: string): string {
return envVar.replace(RegExp('^refs/(heads|tags)/'), '')
return envVar.replace(RegExp('^refs/(heads|tags|pull)/'), '')
}