Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action
What part(s) of the article would you like to see updated?
The documentation is unclear about whether the vars context is available inside composite actions.
The contexts reference lists vars as an available context, which can reasonably lead users to assume that this works inside a composite action:
runs:
using: composite
steps:
- shell: bash
run: echo "${{ vars.AWS_REGION }}"
However, the Composite Actions ADR states:
"Composite actions should leverage inputs to get values they need, they will not have full access to the context objects."
There is also an implementation detail documented by a runner collaborator in actions/runner#4311: variables are filtered based on references made directly in the calling job, so a vars reference used only inside a composite action may not be available to the runner.
Could the composite actions documentation explicitly clarify that values required by a composite action should be passed through inputs, including values originating from vars?
For example:
- uses: ./my-action
with:
region: ${{ vars.AWS_REGION }}
and then inside the composite action:
This would make the relationship between the general contexts documentation and the more limited context availability of composite actions clearer.
Thanks
Additional information
No response
Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/reference/workflows-and-actions/contexts
https://docs.github.com/en/actions/sharing-automations/creating-actions/creating-a-composite-action
What part(s) of the article would you like to see updated?
The documentation is unclear about whether the
varscontext is available inside composite actions.The contexts reference lists
varsas an available context, which can reasonably lead users to assume that this works inside a composite action:However, the Composite Actions ADR states:
There is also an implementation detail documented by a runner collaborator in actions/runner#4311: variables are filtered based on references made directly in the calling job, so a
varsreference used only inside a composite action may not be available to the runner.Could the composite actions documentation explicitly clarify that values required by a composite action should be passed through
inputs, including values originating fromvars?For example:
and then inside the composite action:
${{ inputs.region }}This would make the relationship between the general contexts documentation and the more limited context availability of composite actions clearer.
Thanks
Additional information
No response