View Source GitHubActions.Config (GitHubActions v0.2.1)
A simple keyword-based configuration API.
examples
Examples
This module is used to define the configuration for GitHubActions.
import GitHubActions.Config
config :linux,
name: "Ubuntu",
runs_on: "ubuntu-latest"
config key: "value"
Link to this section Summary
Functions
Returns the configuration.
Adds the given data to the configuration.
Adds the given value to the configuration under the given key.
Returns the value for key or keys.
Returns the value for key or keys in a tuple.
Returns the value for key or keys.
Reads the configuration from the given path.
Link to this section Types
Link to this section Functions
@spec config() :: config()
Returns the configuration.
Adds the given data to the configuration.
Returns the configuration that was previously stored.
Adds the given value to the configuration under the given key.
Returns the configuration that was previously stored.
Returns the value for key or keys.
examples
Examples
iex> Config.fetch!(:jobs)
[:linux]
iex> Config.fetch!([:linux, :runs_on])
"ubuntu-latest"
iex> Config.fetch!([:linux, :foo])
** (KeyError) key :foo not found in: [name: "Ubuntu", runs_on: "ubuntu-latest"]
Returns the value for key or keys in a tuple.
If the configuration parameter does not exist, the function returns error.
examples
Examples
iex> Config.fetch(:jobs)
{:ok, [:linux]}
iex> Config.fetch(:foo)
:error
iex> Config.fetch([:linux, :name])
{:ok, "Ubuntu"}
Returns the value for key or keys.
If the configuration parameter does not exist, the function returns the default value.
examples
Examples
iex> Config.get(:jobs)
[:linux]
iex> Config.get(:foo, :bar)
:bar
iex> Config.get([:linux, :runs_on])
"ubuntu-latest"
iex> Config.get(:foo)
nil
@spec read(Path.t()) :: :ok | {:error, :enonet}
Reads the configuration from the given path.