mirror of
https://github.com/rlespinasse/github-slug-action.git
synced 2026-06-10 08:40:58 +00:00
fix: support pull-request for slug and slug url
This commit is contained in:
committed by
Romain Lespinasse
parent
75ce03b6a0
commit
78985f84ec
@@ -43,3 +43,7 @@ test('slug_ref: a very long name', () => {
|
|||||||
'an-awesome-feature-very-very-very-very-very-very-very-long-more'
|
'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')
|
||||||
|
})
|
||||||
|
|||||||
@@ -43,3 +43,7 @@ test('slug_url_ref: test trailing', () => {
|
|||||||
test('slug_url_ref: test trailing with dot', () => {
|
test('slug_url_ref: test trailing with dot', () => {
|
||||||
test_slug_url_ref('refs/heads/.an-awesome-Feature.', 'an-awesome-feature')
|
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
2
dist/index.js
vendored
@@ -720,7 +720,7 @@ function replaceAnyDotToHyphen(envVar) {
|
|||||||
return envVar.replace(RegExp('[.]', 'g'), '-');
|
return envVar.replace(RegExp('[.]', 'g'), '-');
|
||||||
}
|
}
|
||||||
function removeRef(envVar) {
|
function removeRef(envVar) {
|
||||||
return envVar.replace(RegExp('^refs/(heads|tags)/'), '');
|
return envVar.replace(RegExp('^refs/(heads|tags|pull)/'), '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
@@ -65,5 +65,5 @@ function replaceAnyDotToHyphen(envVar: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeRef(envVar: string): string {
|
function removeRef(envVar: string): string {
|
||||||
return envVar.replace(RegExp('^refs/(heads|tags)/'), '')
|
return envVar.replace(RegExp('^refs/(heads|tags|pull)/'), '')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user