-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Command and Target Directory to the Actions
Instead of keeping the command to run and the destination to where upload the artifacts harcoded, we can use the action `inputs` and fallback to the built-in configuration. These changes introduce a Data Structure called `Configuration` holding the options coming from the external. The options are lazy in the sense that, the `Configuration` class has a dependency over the `core.getInput` so that we only call the function when we actually need the value. The `Configuration` properties are consumed via their getters.
- Loading branch information
Showing
6 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { getInput } from '@actions/core'; | ||
|
||
export class Configuration { | ||
private static readonly COMMAND = 'yarn build'; | ||
private static readonly TARGET_DIR = './build'; | ||
|
||
constructor(private readonly read: typeof getInput) {} | ||
|
||
public get command(): string { | ||
return this.read('command') || Configuration.COMMAND; | ||
} | ||
|
||
public get targetDir(): string { | ||
return this.read('target-dir') || Configuration.TARGET_DIR; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters