mirror of
https://github.com/varunsridharan/actions-toolkit.git
synced 2025-02-24 07:34:04 +08:00
Added gh_set_env_not_exists
This commit is contained in:
parent
9da388dd1a
commit
a8b3fe20a8
1 changed files with 11 additions and 1 deletions
|
@ -34,9 +34,19 @@ function gh_set_env( $key, $value, $silent = false ) {
|
|||
if ( ! $silent ) {
|
||||
gh_log( "✔️ ENV : ${key} => ${value}" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function gh_set_env_silent( $key, $value ) {
|
||||
gh_set_env( $key, $value, true );
|
||||
}
|
||||
|
||||
function gh_set_env_not_exists( $key, $value, $silent = false ) {
|
||||
if ( ! isset( $_ENV[ $key ] ) ) {
|
||||
gh_set_env( $key, $value, $silent );
|
||||
return true;
|
||||
}
|
||||
if ( ! $silent ) {
|
||||
gh_log( "ℹ️ ENV ${key} ALREADY EXISTS WITH VALUE - {$_ENV[$key]}" );
|
||||
}
|
||||
return false;
|
||||
}
|
Loading…
Reference in a new issue