Copy action from another repo during workflow

I have created an action that I want to use in multiple repositories.
The action cannot be made public.
I know that at the moment it’s not possible to run an action from a private/internal repository (but that it’s in the roadmap).
I want to avoid having to put the action’s code in all my repositories and was wondering if there is a way to copy the action’s code into the executing repository while executing the workflow and then run it, but to not commit any changes to the repository
So my workflow will have something like these steps:
Workflow on R1:
checkout (R1 codes)
checkout R2 (the action repository)
copy R2 action files to R1 folder (all local in runner, nothing committed)
run action A1 from local repository

Is it possible?
thanks.

Yes, you can use the usual checkout action to do it. Here is an example:

    steps:
      - uses: actions/checkout@v2

      - name: Checkout private actions
        uses: actions/checkout@v2
        with:
          repository: org/shared-private-actions
          path: .github/shared-actions
          token: ${{ secrets.PRIVATE_ACCESS_TOKEN }}

      - uses: ./.github/shared-actions/action-name
        with:
          # inputs

Notice that you need to generate a token that has access to the private repository with actions and add it as an org/account secret.

You can have multiple actions in a single repository in separate folders, then you can check it out once and use any of them. Or you can have a repository per action, then you will need to use the checkout step several times.

Thank you so much. It worked!