You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
name: 'My First GitHub Actions'on: pushjobs:
first-job:
name: 'First Job'runs-on: ubuntu-lateststeps:
- name: Say Hello World 1shell: bashrun: | echo "Hello World from step 1"
- name: Say Hello World 2shell: pwshrun: | echo "Hello World from step 2"
Environment Variables
name: 'My First GitHub Actions'on: pushenv:
WORKFLOW_LEVEL: "This value comes from the WORKFLOW level"jobs:
first-job:
name: 'First Job'runs-on: ubuntu-latestenv:
JOB_LEVEL: "This value comes from the JOB level"steps:
- name: Say Hello Worldshell: bashrun: | echo "Hello World"
- name: Check environment variables 1shell: bashenv:
STEP_LEVEL_1: "This value comes from the STEP level #1"run: | echo "workflow level: $WORKFLOW_LEVEL" echo "job level: $JOB_LEVEL" echo "step level 1: $STEP_LEVEL_1" echo "step level 2: $STEP_LEVEL_2" echo "step level 3: $STEP_LEVEL_3"
- name: Check environment variables 2shell: pwshenv:
STEP_LEVEL_2: "This value comes from the STEP level #2"run: | echo "workflow level: $env:WORKFLOW_LEVEL" echo "job level: $env:JOB_LEVEL" echo "step level 1: $env:STEP_LEVEL_1" echo "step level 2: $env:STEP_LEVEL_2" echo "step level 3: $env:STEP_LEVEL_3"
- name: Check environment variables 3shell: bashenv:
STEP_LEVEL_3: "This value comes from the STEP level #3"run: | echo "workflow level: ${{ env.WORKFLOW_LEVEL }}" echo "job level: ${{ env.JOB_LEVEL }}" echo "step level 1: ${{ env.STEP_LEVEL_1 }}" echo "step level 2: ${{ env.STEP_LEVEL_2 }}" echo "step level 3: ${{ env.STEP_LEVEL_3 }}"
Runtime Environment Variables
name: 'My First GitHub Actions'on: pushenv:
PRESET_VALUE: "This is the preset value"jobs:
first-job:
name: 'First Job'runs-on: ubuntu-lateststeps:
- name: Set environment variable 1shell: bashrun: | echo "STEPSET_VALUE_1='This is the value 1 set in the step'" >> $GITHUB_ENV
- name: Set environment variable 2shell: pwshrun: | echo "STEPSET_VALUE_2='This is the value 2 set in the step'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
- name: Check environment variablesshell: bashrun: | echo "preset value: ${{ env.PRESET_VALUE }}" echo "stepset value 1: ${{ env.STEPSET_VALUE_1 }}" echo "stepset value 2: ${{ env.STEPSET_VALUE_2 }}"
Output Values Reference
name: 'My First GitHub Actions'on: pushjobs:
first-job:
name: 'First Job'runs-on: ubuntu-lateststeps:
- name: Set output valueid: firstshell: bashrun: | first_value="This is the value for the first output" echo "::set-output name=first_value::$first_value"
- name: Check output valueshell: bashrun: | echo "first value: ${{ steps.first.outputs.first_value }}"
Output Values Mask
name: 'My First GitHub Actions'on: pushjobs:
first-job:
name: 'First Job'runs-on: ubuntu-lateststeps:
- name: Mask output valueid: firstshell: bashrun: | first_value="This is the value for the first output" echo "::add-mask::$first_value" echo "::set-output name=first_value::$first_value"
- name: Check output valueshell: bashrun: | echo "first value: ${{ steps.first.outputs.first_value }}"