For more information, see " Using the vars context to access configuration variable values". When you define configuration variables, they are automatically available in the vars context. You can create configuration variables for use across multiple workflows, and can define them at either the organization, repository, or environment level.įor example, you can use configuration variables to set default values for parameters passed to build tools at an organization level, but then allow repository owners to override these parameters on a case-by-case basis. Note: Configuration variables for GitHub Actions are in beta and subject to change. The GITHUB_ENV and GITHUB_WORKSPACE default variables are exceptions to this convention. ![]() If you attempt to override the value of one of these default variables, the assignment is ignored.Īny new variables you set that point to a location on the filesystem should have a _PATH suffix. For a complete list of default environment variables, see " Default environment variables" below. When you set an environment variable, you cannot use any of the default environment variable names. For more information about shells, see " Workflow syntax for GitHub Actions." Naming conventions for environment variables # If the workflow specified a Windows runner, you would use the syntax for PowerShell, $env:NAME. By default, Linux runners use the bash shell, so you must use the syntax $NAME. In this example, the workflow specifies ubuntu-latest. ![]() For more information on accessing variable values using contexts, see " Using contexts to access variable values."īecause runner environment variable interpolation is done after a workflow job is sent to a runner machine, you must use the appropriate syntax for the shell that's used on the runner. The values for these variables are set, and scoped, at the workflow, job, and step level respectively. ![]() The example above shows three custom variables being used as environment variables in an echo command: $DAY_OF_WEEK, $Greeting, and $First_Name. You can access env variable values using runner environment variables or using contexts. Today is $DAY_OF_WEEK!" env: First_Name: Mona YAML name: Greeting on variable day on: workflow_dispatch env: DAY_OF_WEEK: Monday jobs: greeting_job: runs-on: ubuntu-latest env: Greeting: Hello steps: - name: "Say Hello Mona it's Monday" run: echo "$Greeting $First_Name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |