Description
Checklist
- I am using the latest version of this action.I have read the latest README and followed the instructions.I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.
Describe your question
I'm trying to host the html report to the github pages it was working earlier and recently started failing and unable to find the path to the folder but when i debugged the file path exists. The only difference im seeing is its tailing .* as a suffix to the file path and unable to get the html.
Relevant links
Public repository:
YAML config:
YAML workflow:
- name: Deploy GitHubPage
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3
if: success() || failure()
with:
github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
publish_dir: projects/big-bend/test-report
Relevant log output
/usr/bin/git rm -r --ignore-unmatch * rm '.nojekyll' rm 'index.html' [INFO] chdir /home/runner/actions_github_pages_1682001738777 [INFO] prepare publishing assets [INFO] copy /runner/_work/ui/ui/projects/big-bend/test-report to /home/runner/actions_github_pages_1682001738777 **cp: no such file or directory: /runner/_work/ui/ui/projects/big-bend/test-report/.*** [INFO] delete excluded assets rm: no paths given [INFO] Created /home/runner/actions_github_pages_1682001738777/.nojekyll
Additional context.
During debugging its also confirmed that the file path and file exists.
cd test-report pwd ls
/runner/_work/ui/ui/projects/big-bend/test-report index.html
Activity
bestickley commentedon Aug 16, 2023
@abolla22, did you ever figure this out? I've also run into a similar issue.I ran into this issue because my build process was mistakenly not created the static assets in the folder I expected. My issues is resolved
iRoySwift commentedon Aug 17, 2023
cp: no such file or directory: /home/runner/work/solana_tools/solana_tools/client/dist/.*
[INFO] ForceOrphan: false
/usr/bin/git clone --depth=1 --single-branch --branch gh-pages **github.com/iRoySwift/solana_tools.git /home/runner/actions_github_pages_1692272013060
Cloning into '/home/runner/actions_github_pages_1692272013060'...
[INFO] clean up /home/runner/actions_github_pages_1692272013060
[INFO] chdir /home/runner/actions_github_pages_1692272013060
/usr/bin/git rm -r --ignore-unmatch *
rm '.nojekyll'
[INFO] chdir /home/runner/actions_github_pages_1692272013060
[INFO] prepare publishing assets
[INFO] copy /home/runner/work/solana_tools/solana_tools/client/dist to /home/runner/actions_github_pages_1692272013060
cp: no such file or directory: /home/runner/work/solana_tools/solana_tools/client/dist/.
[INFO] delete excluded assets
rm: no paths given
anticdimi commentedon Aug 18, 2023
Hi @abolla22 ,
Can you post the steps for solving this problem? :)
peaceiris commentedon Aug 20, 2023
The
publish_dir
should not be empty. Please set the correct path to your directory including building assets.peaceiris commentedon Aug 20, 2023
Here is my new example repo. FYI https://github.com/peaceiris/test-mdbook
bombsimon commentedon Sep 9, 2023
I seem to have this issue as well but I do have the
publish_dir
set. My workflow used to work fine but stopped working without any changes to the action.It used to work fine 5 months ago (sadly logs no longer available). In the latest build I see
The path is correct however, in that workflow I added a list of the directory to confirm it has content:
So I assume it would've worked if the copy command had been just
*
instead of.*
.EDIT Looks like assuming there are hidden files is the issue here.
At this line both
*
and.*
are unconditionally copied but I think we need to check if hidden files exist, doesn't seem like there's any option for this in shelljs docs.actions-gh-pages/src/git-utils.ts
Line 60 in 579d468
Update
I think I was a bit too quick commenting on this issue! I did some more debugging and this is indeed just a silently accepted command, it will copy all other files even if the
.*
fails.So it seems like this is working as intended and the reason I saw
nothing to commit, working tree clean
is because I actually don't have any changes in my PR. I need to debug and figure out why the changes I'm expecting isn't a part of the artifacts but that's not related to this action!liudonghua123 commentedon Dec 27, 2023
I have the similar issue, the
publishDir
directory does not contain.*
files, so cp from shelljs returns error.actions-gh-pages/src/git-utils.ts
Lines 59 to 60 in 74d2f4c
I debugged this line of code (
cp('-RfL', ['dist/*', 'dist/.*'], '/tmp')
),'dist/*'
will expand as expected while'dist/.*'
will not and if thepublishDir
does not contains dot file, it will failed to executecp
.Maybe it should process
${publishDir}/.*
with care whencp
.bombsimon commentedon Jan 30, 2024
I was planning to reply to this but time got away for me and I didn't. But anyhow, it seems like you came to the exact same conclusion as me. If there are no hidden files an error will be thrown. However, the reason I never PRed this like you did was because even though this fails, the library used fails silently and proceeds to the next element in the lit for
cp
.So for me, even though I don't have any hidden files and even though the command fails, it still copied all the other files. Did you actually confirm that without this fix the non hidden files does not get copied and with your fix they do? Because even though we had the same issue and came to the same conclusion, this fix was not needed for me.
nick-cjyx9 commentedon May 4, 2024
That's it, no matter whether there are hidden files, files will be copied successfully.
So I think this issue and PR #1047 could be closed. @liudonghua123
see my workflow runs : "nothing to commit" because the static files didn't change at all
Running expectedly , but there's still
cp: no such file or directory
errorgflohr commentedon Feb 20, 2025
I think the problem is this bit of code:
In my case,
publishDir
is populated but has no hidden files (${publishDir}/.*
). The output of the action then looks like this:It is really easy to overlook the
.*
here. The fix would be to only copy hidden files and directories if they exist. The error message is copied from a recent action run in the repository https://github.com/gflohr/qgoda-action-test.Another point: If the
publish_dir
should not be empty, shouldn't the action fail if thecp
fails?Workaround for everybody that runs into the same problem: Create a file
.exists
inside${publishDir}
before you run the action.bombsimon commentedon Feb 20, 2025
@gflohr did you read the comments above? In particular #892 (comment) and the "Update" part of #892 (comment)?
The library used "fails" silently and moves on to the next element so even if you have no hidden files everything else should be copied. You don't need to create
.exists
or similar.Did you actually confirm it fails or is it an assumption? Do you have a reproducible example or a link to a failing pipeline where you have non hidden files that doesn't get copied?
gflohr commentedon Feb 20, 2025
Yes, I read them and I disagree. I don't want to see error messages, when there are actually no errors (no hidden files). But I do want to see a failure, if there really is an error. My first concern can be fixed with the dummy
.exists
. And about my second concern, we apparently disagree, don't worry, that's okay.bombsimon commentedon Feb 20, 2025
My bad, I interpreted your message as it wasn't working for you, I ended up troubleshooting some time for no reason so just wanted to spare others. Putting the file there for sure removes the logging but has no affect on the result if you have other files so that's why I got confused.
Regarding not showing error messages when there are no errors and failing when there are, I agree with you! However whether or not no files is an error or not I guess is more contextual and might be best off as a configurable option, at least for non hidden files.
gflohr commentedon Feb 20, 2025
Sorry for having kept you busy. I probably didn't make my point clear enough.
Maybe I can explain my perspective. Not being a GitHub action wizard, I was trying to get my custom action https://github.com/gflohr/qgoda-action working, inside the test repo https://github.com/gflohr/qgoda-action-test. What a user sees is the INFO output about copying
publishDir
todestDir
followed by an error message. Okay, the step succeeds, but what I assumed was that the copying failed and the error was just ignored. I spent quite some time debugging this because I overlooked the dot before the wildcard. For me, it was just one copy statement (the INFO) and one error message, and I concluded that the step as a whole had failed. With a real repo I probably would have noticed that the content still got updated but my repo is a test repo and I didn't change the content.create hidden file in _site