Skip to content

Commit 6d167e1

Browse files
committed
fix: Remove unnecessary fields from job json
1 parent ab2a735 commit 6d167e1

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/package/job.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,21 @@ export class Job {
5151
public toJSON(): Record<string, unknown> {
5252
return {
5353
"runs-on": this._config.runsOn,
54-
permissions: permissionsJSON(this._config.permissions),
55-
"timeout-minutes": this._config.timeoutMinutes,
56-
outputs: this._config.outputs,
57-
needs: this._config.needs,
58-
if: this._config.if,
54+
55+
...(this._config.permissions && {
56+
permissions: permissionsJSON(this._config.permissions),
57+
}),
58+
59+
...(this._config.timeoutMinutes && {
60+
"timeout-minutes": this._config.timeoutMinutes,
61+
}),
62+
63+
...(this._config.outputs && { outputs: this._config.outputs }),
64+
65+
...(this._config.needs && { needs: this._config.needs }),
66+
67+
...(this._config.if && { if: this._config.if }),
68+
5969
steps: this._steps.map((step) => stepJSON(step)),
6070
};
6171
}

0 commit comments

Comments
 (0)