-
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
Unable to clone outside of GITHUB_WORKSPACE directory #197
Comments
I could be wrong, but I think that's a reserved variable that already has meaning in this system. |
Why do you need to specify where the code is cloned? This action takes care of that for you. |
Today the |
So we're running a self-hosted runner, so the runner is in /etc and we don't want our code to be on that location. @jsg2021 Thanks @ericsciple . The limitation with path parameter is as you said, it needs to be under GITHUB_WORKSPACE. Tried with absolute paths and ../../{blabla} but error hapenned. |
This is important functionality for our builds because we have long repository names. We're getting paths like: We're hitting MAX_PATH on Windows builds. We need to be able to checkout and build in a directory like: |
I was running into the same issue, @ericsciple thanks for the workaround suggestion! :) do you know if the |
On windows, too Run actions/checkout@v2
with:
path: C:/nodejs
repository: gengjiawen/node
token: ***
ssh-strict: true
persist-credentials: true
clean: true
fetch-depth: 1
lfs: false
submodules: false
env:
PYTHON_VERSION: 3.8
FLAKY_TESTS: dontcare
Error: Repository path 'C:\nodejs' is not under 'D:\a\node\node' |
Fixes actions#327, Fixes actions#197. And i also hit this.
Fixes actions#327, Fixes actions#197. And i also hit this.
Fixes actions#327, Fixes actions#197. And i also hit this.
Hi, running into the same issue. Thanks to @LebedevRI for the fix. But any idea when this fix will be available? |
I tried configuring self hosted runner as suggested by @pvanloo in above [comment] (#197 (comment)) and it worked for me. If someone needs a specific workspace, I would suggest to give a try with self hosted runner and specify your workspace path in work folder configuration. |
We had found this issue because the long GITHUB_WORKSPACE base paths caused us to run into MAX_PATH issues on our Windows build server. We never had this issue with Azure DevOps since their base path is about one-third the length. By using the changes in #388 by @LebedevRI, we were able to work around the issue and use GitHub Actions for our workflow. We need those changes implemented officially in the Checkout action though and would appreciate those changes being merged soon. |
I wish we could tell checkout that when cloning an subproject (within a different repository) to instead clone the parent one recursively just so that way it can basically properly build the subproject (especially when it depends on files from within the parent project and imports them and expects those files to exist when building. |
I would like you to take a look at submodules and how some people have them depend on the parent project in order to build the submodules successfully. Many programmers do that for a reason to help try to reduce maintenance on the code especially when some subprojects might require a ton of work and so makes more sense to do it in a submodule, then when the work is done update the module in the parent repository. So this is what I think actions/checkout should allow:
|
In my case I wanted to integrate a repo in a workflow such as I am going with: (...)
path: repo-name-${{ github.run_id }}-${{ github.run_number }}
- run: mv repo-name-${{ github.run_id }}-${{ github.run_number }} ../repo-name
(...) |
The checkout action disallows cloning a repo anywhere outside GITHUB_WORKSPACE which, in linux, translates into /home/runner/work/Mojee/Mojee. If I just clone both repos in side by side: /home/runner/work/Mojee/Mojee/mojee /home/runner/work/Mojee/Mojee/mojee-dev Then subsequent retype steps won't find 'retype.json' as they rely on having the repo cloned at root. If I just clone the private repo within the actual repo: /home/runner/work/Mojee/Mojee (this repo) /home/runner/work/Mojee/Mojee/mojee-dev (code repo) Then, .md files within the code repo would also become documentation articles in the produced page. Thus, the solution found was just to clone it with an unique name and move it with actual repo name to the desired location. There's a feature request in the checkout action open at actions/checkout#197.
Looking for a solution soon |
$GITHUB_WORKSPACE cannot be changed, so there is not control over where the repo is cloned. So absolute paths don't work. reference: actions/checkout#197
For now, I removed that validation and it worked! I'd like to use oficial release without that validation! |
Thank you @fabriciomurta I had the same case, and your solution #197 (comment) worked like a charm! |
The problem also complicates if your previous steps used a container to do the work and new step uses base machine, now you have code which is owner by a root in a non-root owned workspace. Any execution which happens on base node fails since the code cannot be cleaned/checked out. Anyway to disable the "workspace" mapping into the container? |
I found a workaround for this. Our CI build was failing with long path issues. Then I have updated the below file with custom directory paths then it worked like a charm. This works fine as long as same repo is checked out from git action. First you need to run the workflow, which performs one round of checkout, later you make the below changes. file: runner-work-area\_PipelineMapping\your-org\repo-name\PipelineFolder.json Default contents of the file: Custom contents of the file: Note the custom directory value |
Just stumbled upon this issue. What an arbitrary limitation. Why? (btw, how come 40 year of development wasn't enough to properly support the concept of directories? Windows is hopeless. It would have died long ago if they didn't had it installed in schools. Which hopefully soon will get banned.) |
i have to checkout 2 repos, this also affects me. |
This addresses the following error: Error: Repository path '/home/runner/work/SlicerDMRI/Slicer' is not under '/home/runner/work/SlicerDMRI/SlicerDMRI' See actions/checkout#197
This addresses the following error: Error: Repository path '/home/runner/work/SlicerDMRI/Slicer' is not under '/home/runner/work/SlicerDMRI/SlicerDMRI' See actions/checkout#197
what is the workaround? fetch the branch as zip and extract into outside of workspace folder? seems |
I put a workaround further up
That way you can for example extract things into D:/a/rust-build/rust-build, but then do any compiling via D:/rust as they both point to the same place |
Please check if this helps: #197 (comment) |
I have made this PR #1493 exactly for this issue. |
I'm doing another follow-up on this request regarding PR #1493 |
|
If you have a repository name that ends in a dot, you can't use the checkout action on a Windows runner, because the workspace directory is always the repository name, but Windows doesn't allow for directory names with a trailing dot... For example: M.A.R.S. |
@eXpl0it3r why don't you just check out to an explicitly specified directory name like |
See the issue we're in. I can't clone anywhere else other than the |
You may have missed the workaround in my comment further above:
If you do a Or is the problem you're having that the agent fails to spawn properly as it tries to pre-create the |
That's possible indeed, I mostly wanted to report this additional limitation/issue with the Action as is |
github actions prevents cloning a repo outside of the current working directory: actions/checkout#197
github actions prevents cloning a repo outside of the current working directory: actions/checkout#197
I ran into issues using |
Hi Guys. I have a directory where the source code is located. I'm trying to create an action to:
Anyway, I set the env var $GITHUB_WORKSPACE into my yml file, but it seems to be not respecting the directory where the code is cloned / pulled in.
My script:
The log says the following:
Is there anyway I can use the existing directory to use the checkout action? I want this to be cloned on /home/my-code/src
Thanks
The text was updated successfully, but these errors were encountered: