diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5cd67cc..dd74ced 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,7 @@ jobs: env: EXAMPLE_VAR: 'Value' with: + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} @@ -40,6 +41,7 @@ jobs: env: EXAMPLE_VAR: 'Value' with: + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} @@ -56,6 +58,7 @@ jobs: EXAMPLE_VAR: 'Value' with: contexts: 'env' + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} @@ -72,6 +75,7 @@ jobs: EXAMPLE_VAR: 'Value' with: contexts: 'github,env' + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} @@ -84,6 +88,7 @@ jobs: context: - github - env + - vars - job - steps - runner @@ -101,5 +106,6 @@ jobs: EXAMPLE_VAR: 'Value' with: contexts: ${{ matrix.context }} + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} diff --git a/README.md b/README.md index 0930d1c..c6d8f6d 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,14 @@ This action prints actions contexts for debugging with: # Optional # Specify which contexts to print - # Default: 'github,env,job,steps,runner,secrets,strategy,matrix,needs,inputs' + # Default: 'github,env,vars,job,steps,runner,secrets,strategy,matrix,needs,inputs' contexts: '' + # Optional + # Provide vars context to action, as vars context is not available in composite workflows + # Default: null + vars_context: ${{ toJson(vars) }} + # Optional # Provide secrets context to action, as secrets context is not available in composite workflows # Default: null @@ -45,6 +50,7 @@ job: context: - github - env + - vars - job - steps - runner @@ -57,6 +63,7 @@ job: - uses: henrygriffiths/debug_action@v1 with: contexts: ${{ matrix.context }} + vars_context: ${{ toJson(vars) }} secrets_context: ${{ toJson(secrets) }} needs_context: ${{ toJson(needs) }} ``` diff --git a/action.yml b/action.yml index 1c6e220..d92b8ba 100644 --- a/action.yml +++ b/action.yml @@ -9,7 +9,11 @@ inputs: contexts: description: 'Contexts to dump' required: false - default: 'github,env,job,steps,runner,secrets,strategy,matrix,needs,inputs' + default: 'github,env,vars,job,steps,runner,secrets,strategy,matrix,needs,inputs' + vars_context: + description: 'Vars Context' + required: false + default: 'Vars Context not provided' secrets_context: description: 'Secrets Context' required: false @@ -26,6 +30,7 @@ runs: env: GITHUB_CONTEXT: ${{ toJson(github) }} ENV_CONTEXT: ${{ toJson(env) }} + VARS_CONTEXT: ${{ inputs.vars_context }} JOB_CONTEXT: ${{ toJson(job) }} STEPS_CONTEXT: ${{ toJson(steps) }} RUNNER_CONTEXT: ${{ toJson(runner) }} diff --git a/debug_action.sh b/debug_action.sh index 4aba335..20bcd39 100755 --- a/debug_action.sh +++ b/debug_action.sh @@ -16,6 +16,10 @@ do echo -e "\033[1;33m>>>>>> Env Context\033[0m" echo -e "$ENV_CONTEXT" echo -e "\033[1;33m<<<<<< Env Context\033[0m" + elif [ $x == 'vars' ]; then + echo -e "\033[1;33m>>>>>> Vars Context\033[0m" + echo -e "$VARS_CONTEXT" + echo -e "\033[1;33m<<<<<< Vars Context\033[0m" elif [ $x == 'job' ]; then echo -e "\033[1;33m>>>>>> Job Context\033[0m" echo -e "$JOB_CONTEXT"