3
0
Fork 0
mirror of https://gitea.com/docker/metadata-action.git synced 2024-11-22 03:59:33 +01:00

Merge pull request #301 from crazy-max/dedup-labels

dedup and sort labels
This commit is contained in:
CrazyMax 2023-06-13 12:02:17 +02:00 committed by GitHub
commit 38650bbf6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 736 additions and 725 deletions

File diff suppressed because it is too large Load diff

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -466,7 +466,18 @@ export class Meta {
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
];
labels.push(...this.inputs.labels);
return labels;
return Array.from(
new Map<string, string>(
labels
.map(label => label.split('='))
// eslint-disable-next-line @typescript-eslint/no-unused-vars
.filter(([_key, ...values]) => values.length > 0)
.map(([key, ...values]) => [key, values.join('=')] as [string, string])
)
)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([key, value]) => `${key}=${value}`);
}
public getJSON(): unknown {