This is similar to Ref Head in Reusable Workflows but not exactly the same issue.
Inside a Reusable Workflow (the called workflow) I want to have access to the ref used by the caller.
Example of caller: Here I want to get the value of
my-ref (as environment variable for example) inside my reusable workflow.
name: Terraform Lint on: push: branches: - main pull_request: branches: - main jobs: terraform-lint: uses: org/repo/.github/workflows/my-reusable-workflow.yml@my-ref with: test: test
I know that I can pass it as inputs also but having it by default will be better to avoid duplicate values since we can’t use variables in the
uses keyword yet.
My use case is that I want to download a file inside the repo
org/repo using the same ref.
Example of the reusable workflow:
on: workflow_call: jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 name: Checkout source code - name: Downloading the default .tflint.hcl from the workflows repo uses: terraform-linters/tflint-load-config-action@v0 with: source-repo: org/repo source-path: .github/workflows/files/.tflint.hcl # TODO: find a way to get the workflow version set by the caller workflow instead of adding a new input source-ref: TODO