-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download Files/Folders from another Repository #1525
Comments
Ok, it looks like one must use But that creates the |
I can do something like this: - name: Checkout single file
run: |
git remote add some-repo https://github.com/company/some-repo.git
git fetch some-repo main
git checkout some-repo/main -- scripts/generateActionsDoc.ts And that works perfectly. These commands interact with the So I wonder if we can do the same with the |
Every time actions/checkout is used, all previous context is removed unless you specify a special flag: actions/checkout#1525 This causes a bug with empty allure report. This commit fixes this bug. Signed-off-by: Oleg Kulachenko <oleg@nspcc.ru>
This is how to do it according to the documentation:
This example is for private repos. For public ones you don't need the |
It looks like it happens when the second checkout tries to use the root directory. Instead of this - name: Checkout lib
uses: actions/checkout@v4
with:
repository: owner/repo
path: lib
- name: Checkout
uses: actions/checkout@v4 do this - name: Checkout
uses: actions/checkout@v4
- name: Checkout lib
uses: actions/checkout@v4
with:
repository: owner/repo
path: lib |
That's exactly the case I was trying to achieve - name: Checkout
uses: actions/checkout@v4
- name: Checkout lib
uses: actions/checkout@v4
with:
repository: owner/second-repo
path: second-repo The problem with this "official approach" is that this creates the
So you are ending with two steps - name: Checkout lib
uses: actions/checkout@v4
with:
repository: owner/second-repo
path: second-repo
- name: Move my second-repo files
run: |
mv -r !(.*|*.git) ..
rm -rf second-repo Explanation:
So there is this proposed hacky way to use a named remote - name: Checkout single file
run: |
git remote add some-repo https://github.com/company/some-repo.git
git fetch some-repo main
git checkout some-repo/main -- scripts/generateActionsDoc. Explanation:
The best part, is that this does not switch branches and it only "downloads" the specified file. Now this approach has its own flaws of course when it comes to downloading folders. It would look something like that git sparse-checkout init --cone
git sparse-checkout set <folder-path>
git remote add some-repo https://github.com/company/some-repo.git
git fetch some-repo
git checkout some-repo/main So for more complex situation a combination of |
My point is that this use-case is not well documented and that the action is missing that extra functionality, to easily add (download) files/folders from other repositories into the root folder. |
I have a very basic scenario.
And in the output (and using
ls
) I can see that contents of the repo is always deletedI believe it is a bug or design flaw for this action and missing documentation on this behaviour.
The text was updated successfully, but these errors were encountered: