Skip to content

Commit

Permalink
Don't set outputs if empty or nil
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Sep 24, 2021
1 parent a41d90b commit 91520df
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/buildx.ts
Expand Up @@ -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> {
Expand All @@ -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> {
Expand Down

0 comments on commit 91520df

Please sign in to comment.