IssueRaiser

make reference accessible in reusable workflow

**Describe the enhancement** A reusable workflow should be able to access the reference that it was called for. **Context** A reusable workflow in public repos may be [called by appending a reference](https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow) which can be a SHA, a release tag, or a branch name, as for example: `{owner}/{repo}/.github/workflows/{filename}@{ref}` Githubs [documentation](https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview) states: > When a reusable workflow is triggered by a caller workflow, the github context is always associated with the caller workflow. **The problem** Since the github context is always associated with the caller workflow, the reusable workflow cannot access the reference, for example the tag `v1.0.0`. However, knowing the reference is important when the reusable workflow needs to checkout the repository in order to make use of composite actions. **Code snippet** Assume that the caller workflow is being executed from within the `main` branch and calls the ref `v1.0.0.` of a reusable workflow: ``` name: Caller workflow on: workflow_dispatch: jobs: caller: uses: owner/public-repo/.github/workflows/reusable-workflow.yml@v1.0.0 ``` Here is the reusable workflow that uses a composite action: ``` name: reusable workflows on: workflow_call: jobs: first-job: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3.1.0 w

Posted by kagahd on Dec 13, 2022, 10:43 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,500 issues0 comments

github (E-commerce)

make reference accessible in reusable workflow

kagahdDec 13, 2022, 10:43 AM

**Describe the enhancement** A reusable workflow should be able to access the reference that it was called for. **Context** A reusable workflow in public repos may be [called by appending a reference](https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow) which can be a SHA, a release tag, or a branch name, as for example: `{owner}/{repo}/.github/workflows/{filename}@{ref}` Githubs [documentation](https://docs.github.com/en/actions/using-workflows/reusing-workflows#overview) states: > When a reusable workflow is triggered by a caller workflow, the github context is always associated with the caller workflow. **The problem** Since the github context is always associated with the caller workflow, the reusable workflow cannot access the reference, for example the tag `v1.0.0`. However, knowing the reference is important when the reusable workflow needs to checkout the repository in order to make use of composite actions. **Code snippet** Assume that the caller workflow is being executed from within the `main` branch and calls the ref `v1.0.0.` of a reusable workflow: ``` name: Caller workflow on: workflow_dispatch: jobs: caller: uses: owner/public-repo/.github/workflows/reusable-workflow.yml@v1.0.0 ``` Here is the reusable workflow that uses a composite action: ``` name: reusable workflows on: workflow_call: jobs: first-job: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3.1.0 w

Comments (0)

No comments yet. Start the discussion.

Comment on this issue