github-actions

How to access the repo that calls a shared action


In a GitHub shared action, is it possible to know the full name (with owner) of the repo from which the action has been called?

For instance with two repos:

And the shared action should echo owner/caller.


Solution

  • Variable Description Example Value
    ${{ github.repository }} Full repo path (owner/repo) owner/caller
    ${{ github.repository_owner }} Just the owner (organization/user) owner
    ${{ github.event.repository.name }} Just the repository name (no owner) caller

    Example composition action:

    # .github/actions/called/action.yml
    name: "Called Action"
    description: "An action that knows who called it"
    
    runs:
      using: "composite"
      steps:
        - name: Echo caller repository
          shell: bash
          run: |
            echo "Caller repository: ${{ github.repository }}"
            echo "Caller owner: ${{ github.repository_owner }}"
            echo "Caller repo name: ${{ github.event.repository.name }}"
    

    This allows your shared action to respond differently depending on the caller — useful for logging, access control, repo-specific logic, or telemetry.

    Bonus point: If you're using this in a reusable workflow (via workflow_call), these variables still work, but if you're trying to explicitly pass these into a called action or workflow, you can also pass them as inputs:

    # In the caller workflow
    uses: owner/repo/.github/workflows/reusable.yml@main
    with:
      caller_repo: ${{ github.repository }}