Code Monkey home page Code Monkey logo

Comments (9)

nick-cjyx9 avatar nick-cjyx9 commented on September 17, 2024 2

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

from actions-gh-pages.

bombsimon avatar bombsimon commented on September 17, 2024 1

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!

from actions-gh-pages.

bombsimon avatar bombsimon commented on September 17, 2024 1

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.

from actions-gh-pages.

bestickley avatar bestickley commented on September 17, 2024

@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

from actions-gh-pages.

iRoySwift avatar iRoySwift commented on September 17, 2024

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

from actions-gh-pages.

anticdimi avatar anticdimi commented on September 17, 2024

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

from actions-gh-pages.

peaceiris avatar peaceiris commented on September 17, 2024

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

from actions-gh-pages.

peaceiris avatar peaceiris commented on September 17, 2024

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

from actions-gh-pages.

liudonghua123 avatar liudonghua123 commented on September 17, 2024

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.

from actions-gh-pages.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.