@@ -581,6 +581,64 @@ build.
581581 to an overview and a pointer into those docs. The README is always present;
582582 it is the entry point, not the whole manual.
583583
584+ ## Reusable workflows with co-located composite actions
585+
586+ When a reusable workflow (` on: workflow_call ` ) has its own composite actions
587+ (stored in ` .github/actions/ ` alongside it), those actions are initially local
588+ to a single workflow — the workflow itself. If a reusable workflow is the only
589+ caller of such an action, it should stay co-located and not be promoted to a
590+ standalone repository.
591+
592+ ** The problem:** A reusable workflow runs in the * caller's* checked-out workspace,
593+ not in its own repository. When the workflow tries to ` uses: ` a relative action
594+ path (e.g., ` ./.github/actions/my-action/ ` ), that path resolves to the * caller's*
595+ repository, not the reusable workflow's repo — so it fails or runs the wrong
596+ version of the action.
597+
598+ ** The solution:** The reusable workflow must check itself out first, using the
599+ ` job.workflow_repository ` and ` job.workflow_sha ` contexts provided by GitHub
600+ Actions. These contexts give the exact repository and commit SHA of the reusable
601+ workflow being executed, not the caller.
602+
603+ - ** Check out the reusable workflow's own repository** at the start of the job,
604+ using ` job.workflow_repository ` and ` job.workflow_sha ` , before calling any
605+ local composite actions. This ensures the actions resolve in the reusable
606+ workflow's own workspace.
607+ - ** Use a ` path: ` argument** in the checkout step to place the reusable workflow
608+ in a separate subdirectory, so you can distinguish it from the caller's
609+ checkout and reference actions under that path.
610+ - The same reusable workflow will then work correctly whether invoked at a
611+ tagged release (e.g., ` v1.2.3 ` ) or on a development branch, and the caller
612+ automatically gets the right version of both the workflow and its actions.
613+
614+ ``` yaml
615+ jobs :
616+ # Reusable workflow with co-located composite actions
617+ my-task :
618+ runs-on : ubuntu-24.04
619+ permissions :
620+ contents : read
621+ steps :
622+ # Check out the reusable workflow's own repository
623+ # (not the caller's — that's assumed to be the default checkout)
624+ - name : Check out the reusable workflow
625+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
626+ with :
627+ repository : ${{ job.workflow_repository }}
628+ ref : ${{ job.workflow_sha }}
629+ path : workflow
630+
631+ # Now call the co-located action from the workflow's path
632+ - name : Run the workflow's action
633+ uses : ./workflow/.github/actions/my-action
634+ with :
635+ input-value : example
636+ ` ` `
637+
638+ **Availability:** ` job.workflow_repository` and `job.workflow_sha` are available
639+ on GitHub.com and GitHub Enterprise Cloud (GHEC).
640+ They are **not** available on GitHub Enterprise Server (GHES).
641+
584642# # Concurrency
585643
586644Declare `concurrency` on workflows that must not race — anything that
0 commit comments