This commit is contained in:
Runye Zhang 2026-04-27 10:07:21 +02:00 committed by GitHub
commit b36d9ccefd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 97 additions and 1 deletions

View file

@ -3923,6 +3923,102 @@ describe('raw', () => {
],
undefined
],
[
'raw11',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=.t/'\[e]-=`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: 't-e---',
partial: [],
latest: false
} as Version,
[
'user/app:t-e---'
],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=t-e---"
],
undefined
],
[
'raw12',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=-foobar`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: 'foobar',
partial: [],
latest: false
} as Version,
[
'user/app:foobar'
],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foobar"
],
undefined
],
[
'raw13',
'event_push_dev.env',
{
images: ['user/app'],
tags: [
`type=raw,value=...---foo.bar`
],
flavor: [
`latest=false`
]
} as Inputs,
{
main: 'foo.bar',
partial: [],
latest: false
} as Version,
[
'user/app:foo.bar'
],
[
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
"org.opencontainers.image.description=This your first repo!",
"org.opencontainers.image.licenses=MIT",
"org.opencontainers.image.revision=860c1904a1ce19322e91ac35af1ab07466440c37",
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
"org.opencontainers.image.title=Hello-World",
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
"org.opencontainers.image.version=foo.bar"
],
undefined
],
])('given %o with %o event', tagsLabelsTest);
});

View file

@ -656,7 +656,7 @@ export class Meta {
}
private static sanitizeTag(tag: string): string {
return tag.replace(/[^a-zA-Z0-9._-]+/g, '-');
return tag.replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^[^a-zA-Z0-9_]+/, '');
}
private static shortSha(sha: string): string {