Skip to content

support: no such file or directory and suffix is being added to the end of file directory .* #892

Open
@abolla22

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

changed the title support: support: no such file or directory and suffix is being added to the end of file directory .* on Apr 24, 2023
bestickley

bestickley commented on Aug 16, 2023

@bestickley

@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

iRoySwift commented on Aug 17, 2023

@iRoySwift

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

anticdimi commented on Aug 18, 2023

@anticdimi

Hi @abolla22 ,
Can you post the steps for solving this problem? :)

peaceiris

peaceiris commented on Aug 20, 2023

@peaceiris
Owner

The publish_dir should not be empty. Please set the correct path to your directory including building assets.

peaceiris

peaceiris commented on Aug 20, 2023

@peaceiris
Owner

Here is my new example repo. FYI https://github.com/peaceiris/test-mdbook

bombsimon

bombsimon commented on Sep 9, 2023

@bombsimon

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.

- name: Deploy to GitHub Pages
  uses: peaceiris/actions-gh-pages@v3
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_dir: ./dist

It used to work fine 5 months ago (sadly logs no longer available). In the latest build I see

  [INFO] chdir /home/runner/actions_github_pages_1694213859334
  [INFO] prepare publishing assets
  [INFO] copy /home/runner/work/a-calculator/a-calculator/dist to /home/runner/actions_github_pages_1694213859334
  cp: no such file or directory: /home/runner/work/a-calculator/a-calculator/dist/.*

The path is correct however, in that workflow I added a list of the directory to confirm it has content:

Run ls -l /home/runner/work/a-calculator/a-calculator/dist || true
total 12
drwxr-xr-x 2 runner docker 4096 Sep  8 22:57 assets
-rw-r--r-- 1 runner docker  794 Sep  8 22:57 index.html
-rw-r--r-- 1 runner docker 1497 Sep  8 22:57 vite.svg

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.

› tree -a
.
├── dst
├── src
│   ├── .foo
└── src-no-hidden
    └── foo

› cp -RfL src/.* dst

› cp -RfL src-no-hidden/.* dst
zsh: no matches found: src-no-hidden/.*

› tree -a
.
├── dst
│   └── .foo
├── src
│   └── .foo
└── src-no-hidden
    └── foo

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.

cp('-RfL', [`${publishDir}/*`, `${publishDir}/.*`], destDir);

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

liudonghua123 commented on Dec 27, 2023

@liudonghua123

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.

- name: Deploy to GitHub Pages
  uses: peaceiris/actions-gh-pages@v3
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_dir: ./dist

It used to work fine 5 months ago (sadly logs no longer available). In the latest build I see

  [INFO] chdir /home/runner/actions_github_pages_1694213859334
  [INFO] prepare publishing assets
  [INFO] copy /home/runner/work/a-calculator/a-calculator/dist to /home/runner/actions_github_pages_1694213859334
  cp: no such file or directory: /home/runner/work/a-calculator/a-calculator/dist/.*

The path is correct however, in that workflow I added a list of the directory to confirm it has content:

Run ls -l /home/runner/work/a-calculator/a-calculator/dist || true
total 12
drwxr-xr-x 2 runner docker 4096 Sep  8 22:57 assets
-rw-r--r-- 1 runner docker  794 Sep  8 22:57 index.html
-rw-r--r-- 1 runner docker 1497 Sep  8 22:57 vite.svg

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.

› tree -a
.
├── dst
├── src
│   ├── .foo
└── src-no-hidden
    └── foo

› cp -RfL src/.* dst

› cp -RfL src-no-hidden/.* dst
zsh: no matches found: src-no-hidden/.*

› tree -a
.
├── dst
│   └── .foo
├── src
│   └── .foo
└── src-no-hidden
    └── foo

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.

cp('-RfL', [`${publishDir}/*`, `${publishDir}/.*`], destDir);

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!

I have the similar issue, the publishDir directory does not contain .* files, so cp from shelljs returns error.

core.info(`[INFO] copy ${publishDir} to ${destDir}`);
cp('-RfL', [`${publishDir}/*`, `${publishDir}/.*`], destDir);

$ node
> const {ls, cp}=require('shelljs')
> const publishDir = 'dist'
> cp('-RfL', [`${publishDir}/*`, `${publishDir}/.*`], '/tmp/');
cp: no such file or directory: dist/.*
[String: ''] {
  stdout: '',
  stderr: 'cp: no such file or directory: dist/.*',
  code: 1,
  cat: [Function: bound ],
  exec: [Function: bound ],
  grep: [Function: bound ],
  head: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  uniq: [Function: bound ]
}
> 
undefined
> ls(`${publishDir}/*`)
[
  'app.aeeadc2a.css',
  'chunk-vendors.caf800b8.css',
  'dist/favicon.ico',
  ...
  stdout: 'app.aeeadc2a.css\n' +
    'chunk-vendors.caf800b8.css\n' +
    'dist/favicon.ico\n' +
    ...
  stderr: null,
  code: 0,
  cat: [Function: bound ],
  exec: [Function: bound ],
  grep: [Function: bound ],
  head: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  uniq: [Function: bound ]
]
> ls(`${publishDir}/.*`)
ls: no such file or directory: dist/.*
[
  stdout: '',
  stderr: 'ls: no such file or directory: dist/.*',
  code: 2,
  cat: [Function: bound ],
  exec: [Function: bound ],
  grep: [Function: bound ],
  head: [Function: bound ],
  sed: [Function: bound ],
  sort: [Function: bound ],
  tail: [Function: bound ],
  to: [Function: bound ],
  toEnd: [Function: bound ],
  uniq: [Function: bound ]
]
>

I debugged this line of code (cp('-RfL', ['dist/*', 'dist/.*'], '/tmp')), 'dist/*' will expand as expected while 'dist/.*' will not and if the publishDir does not contains dot file, it will failed to execute cp.

image

Maybe it should process ${publishDir}/.* with care when cp.

bombsimon

bombsimon commented on Jan 30, 2024

@bombsimon

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

nick-cjyx9 commented on May 4, 2024

@nick-cjyx9

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.

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 error

gflohr

gflohr commented on Feb 20, 2025

@gflohr

The publish_dir should not be empty. Please set the correct path to your directory including building assets.

I think the problem is this bit of code:

core.info(`[INFO] copy ${publishDir} to ${destDir}`);
cp('-RfL', [`${publishDir}/*`, `${publishDir}/.*`], destDir);

In my case, publishDir is populated but has no hidden files (${publishDir}/.*). The output of the action then looks like this:

[INFO] copy /home/runner/work/qgoda-action-test/qgoda-action-test/_site to /home/runner/actions_github_pages_1740041018981
cp: no such file or directory: /home/runner/work/qgoda-action-test/qgoda-action-test/_site/.*

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 the cp fails?

Workaround for everybody that runs into the same problem: Create a file .exists inside ${publishDir} before you run the action.

bombsimon

bombsimon commented on Feb 20, 2025

@bombsimon

@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

gflohr commented on Feb 20, 2025

@gflohr

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

bombsimon commented on Feb 20, 2025

@bombsimon

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

gflohr commented on Feb 20, 2025

@gflohr

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 to destDir 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.

added a commit that references this issue on Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

    Participants

    @liudonghua123@bombsimon@gflohr@anticdimi@peaceiris

    Issue actions

      support: no such file or directory and suffix is being added to the end of file directory .* · Issue #892 · peaceiris/actions-gh-pages