-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# I am a workflow that demonstrates how to output the different context objects | ||
|
||
name: Variables and Context | ||
|
||
# Controls when the action will run. Workflow runs when manually triggered using the UI | ||
# or API. | ||
on: | ||
workflow_dispatch: | ||
# Inputs the workflow accepts. | ||
inputs: | ||
name: | ||
# Friendly description to be shown in the UI instead of 'name' | ||
description: 'Person to greet' | ||
# Default value if no value is explicitly provided | ||
default: 'World' | ||
# Input has to be provided for the workflow to run | ||
required: true | ||
|
||
env: | ||
VAR1: myworkflowvar1 | ||
VAR2: myworkflowvar2 | ||
VAR3: myworkflowvar3 | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
|
||
job1: | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
#step/job output variables | ||
job2: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
output1: ${{ steps.step1.outputs.step1value }} | ||
output2: ${{ steps.step2.outputs.step2value }} | ||
|
||
steps: | ||
- name: Step 1 | ||
id: step1 | ||
run: echo "::set-output name=step1value::hello" | ||
|
||
- name: Step 2 | ||
id: step2 | ||
run: echo "::set-output name=step2value::world" | ||
|
||
job3: | ||
runs-on: ubuntu-latest | ||
needs: job2 | ||
steps: | ||
- run: echo ${{needs.job2.outputs.output1}} ${{needs.job2.outputs.output2}} | ||
|
||
# access/set env variables | ||
job4: | ||
runs-on: ubuntu-latest | ||
env: | ||
VAR2: myjobvar2 | ||
VAR3: myjobvar3 | ||
steps: | ||
|
||
- run: | | ||
echo $VAR1 | ||
echo ${{env.VAR1}} | ||
echo "" | ||
echo $VAR2 | ||
echo $VAR3 | ||
env: | ||
VAR3: mystepvar3 |