Skip to content
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

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

Open
3 tasks done
abolla22 opened this issue Apr 20, 2023 · 9 comments
Open
3 tasks done
Assignees
Labels
support User support

Comments

@abolla22
Copy link

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

@abolla22 abolla22 added the support User support label Apr 20, 2023
@abolla22 abolla22 changed the title support: support: no such file or directory and suffix is being added to the end of file directory .* Apr 24, 2023
@bestickley
Copy link

bestickley commented 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
Copy link

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
Copy link

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

@peaceiris
Copy link
Owner

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

@peaceiris
Copy link
Owner

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

@bombsimon
Copy link

bombsimon commented 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.

- 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
Copy link

liudonghua123 commented Dec 27, 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.

- 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
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support User support
Projects
None yet
Development

No branches or pull requests

8 participants