Within the action, how to get the ref (branch or version) of that action which has been called by a workflow?
In case I call my-action (v1) using:
steps:
- uses: my-action@v1
I need to retrieve the value v1
in my-action. But ${{ github.action_ref }}
only provides the ref of the caller (workflow), not the ref of the called action (my-action).
A solution would be to use in the workflow:
steps:
- uses: my-action@v1
with:
ref: ${{ github.action_ref }}
But I would like to avoid asking the caller to specify this parameter and would prefer to retrieve it directly in the action itself. Is that possible?
I need to checkout the repository which contains the action into the caller repository:
runs:
using: composite
steps:
- name: Checkout current repository
uses: actions/checkout@v3
with:
path: main
- name: Checkout validation repository
uses: actions/checkout@v3
with:
repository: [ORG]/validation
ref: v1.5.3
path: validation