Reputation: 20103
Consider a GitHub Action that:
The binary version depends on the version of the action. When the action is used like
uses: action_x@v3
I am trying to get the v3
inside the action, so that I can map it to the corresponding binary version.
Is there a way to do this without having to hard-code the binary version on the YAML file (and remember to bump it on release)?
Upvotes: 1
Views: 106
Reputation: 125
Looking at GitHub Contexts, it seems that github.action_ref
should contain what you are looking for:
For a step executing an action, this is the ref of the action being executed. For example,
v2
.
jobs:
show_checkout_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo '${{ github.action_ref }}'
Upvotes: 3