feat: test #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Example Workflow | |
on: [push] | |
jobs: | |
set_env_var: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Environment Variable | |
id: set-env | |
run: | | |
echo "MY_ENV_VAR=HelloWorld" >> $GITHUB_ENV | |
outputs: | |
my_env_var: ${{ steps.set-env.outputs.MY_ENV_VAR }} | |
example_job: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
set_env_var, | |
] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Get Environment Variable | |
run: echo "The value of MY_ENV_VAR is ${{ needs.set_env_var.output.my_env_var }}" | |
- name: Use Environment Variable in Another Step | |
run: | | |
if [[ "${{ needs.set_env_var.output.my_env_var }}" == "HelloWorld" ]]; then | |
echo "The environment variable is correctly set!" | |
else | |
echo "The environment variable is not set correctly." | |
fi |