3
0
Fork 0
mirror of https://gitea.com/docker/build-push-action.git synced 2024-11-22 09:29:38 +01:00

Don't set outputs if empty or nil

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-09-24 16:49:17 +02:00
parent a41d90ba13
commit 91520dfd9f
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
2 changed files with 12 additions and 4 deletions

8
dist/index.js generated vendored
View file

@ -57,7 +57,7 @@ function getImageID() {
if (!fs_1.default.existsSync(iidFile)) {
return undefined;
}
return fs_1.default.readFileSync(iidFile, { encoding: 'utf-8' });
return fs_1.default.readFileSync(iidFile, { encoding: 'utf-8' }).trim();
});
}
exports.getImageID = getImageID;
@ -73,7 +73,11 @@ function getMetadata() {
if (!fs_1.default.existsSync(metadataFile)) {
return undefined;
}
return fs_1.default.readFileSync(metadataFile, { encoding: 'utf-8' });
const content = fs_1.default.readFileSync(metadataFile, { encoding: 'utf-8' }).trim();
if (content === 'null') {
return undefined;
}
return content;
});
}
exports.getMetadata = getMetadata;

View file

@ -15,7 +15,7 @@ export async function getImageID(): Promise<string | undefined> {
if (!fs.existsSync(iidFile)) {
return undefined;
}
return fs.readFileSync(iidFile, {encoding: 'utf-8'});
return fs.readFileSync(iidFile, {encoding: 'utf-8'}).trim();
}
export async function getMetadataFile(): Promise<string> {
@ -27,7 +27,11 @@ export async function getMetadata(): Promise<string | undefined> {
if (!fs.existsSync(metadataFile)) {
return undefined;
}
return fs.readFileSync(metadataFile, {encoding: 'utf-8'});
const content = fs.readFileSync(metadataFile, {encoding: 'utf-8'}).trim();
if (content === 'null') {
return undefined;
}
return content;
}
export async function getSecretString(kvp: string): Promise<string> {