Here’s a shorter list of 10 important GitHub Actions environment variables:
- GITHUB_WORKSPACE - The default working directory for steps and location of your repo.
- GITHUB_ACTOR - The name of the person or app that initiated the workflow.
- GITHUB_REPOSITORY - The owner and repository name.
- GITHUB_EVENT_NAME - The name of the event that triggered the workflow.
- GITHUB_SHA - The commit SHA that triggered the workflow.
- GITHUB_REF - The branch or tag ref that triggered the workflow.
- GITHUB_JOB - The ID of the current job.
- GITHUB_RUN_NUMBER - A unique number for each run of a workflow.
- GITHUB_WORKFLOW - The name of the workflow.
- RUNNER_OS - The OS of the runner executing the job (Linux, Windows, macOS).
Para utilizar las variables que se pueden declarar declarar en la UI
jobs:
set_environment:
outputs:
environment_name: ${{ steps.branch_name.outputs.branch }}
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch_name
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
build_and_publish:
name: "Build and Publish to ECR"
needs: set_environment
runs-on: ubuntu-latest
environment:
name: ${{ needs.set_environment.outputs.environment_name}}