15

I'm trying to work out how to use Github Actions to checkout a remote public repo, then add some some sensitive files into it from the current repo, before finally building etc.

I believe I can checkout a remote repo with

steps:
  - name: Checkout
    uses: actions/checkout@v2
    with:
      repository: foo-user/bar-repo

But how do I then copy some files into this checked out repo from files that are in the current repo?

SystemicPlural
  • 5,629
  • 9
  • 49
  • 74

1 Answers1

20

You have a couple options:

Checkout your repo and then checkout the public repo:

steps:
  - name: Checkout
    uses: actions/checkout@v2
    with:
      repository: foo-user/bar-repo
      path: './bar'

Now you can go ahead and copy files from the folder bar into whereever else you want


The other option is to have the public repo as a submodule, then you can simply do:

steps:
  - name: Checkout
    uses: actions/checkout@v2
    with:
      submodules: true
Lucas
  • 1,224
  • 1
  • 14
  • 21
smac89
  • 39,374
  • 15
  • 132
  • 179
  • Thank you. That is very helpful. How would I then copy from one to the other. What paths do I use? Sorry, github actions noob here. – SystemicPlural May 19 '20 at 11:41
  • @SystemicPlural in both cases, your pwd will be the root of your github repo, and the public repo will be inside this folder. So you can do `cp ./bar/file .` to copy `file` from bar into your repo directory – smac89 May 19 '20 at 11:46
  • Does `path` have to be relative? – Raffi Khatchadourian May 16 '23 at 16:33