Actions/checkout in reusable workflows


I’ve been facing several problems with reusable workflows and actions/checkout because it seems to point out all the time to the original repo instead of the repo where the reusable workflow is hosted.

Repo workflow:

    uses: my-reusable-worfklow.yaml@main

Reusable workflow:

    name: "Reusable workflow"
    runs-on: ubuntu-latest
      - uses: actions/checkout@v2

      - id: step2
        run: |
          ls < Here show the original repo not the repo with the reusable workflow

Any hints?

@geret1 I am facing the same problem. My reusable workflow’s checkout action is checking out the repo of my caller workflow. Any solution you found for this ? Please advise.

This is working exactly as designed, see Reusing workflows:

If you reuse a workflow from a different repository, any actions in the called workflow run as if they were part of the caller workflow. For example, if the called workflow uses actions/checkout , the action checks out the contents of the repository that hosts the caller workflow, not the called workflow.

If you want to check out another repository use the repository parameter of actions/checkout.