question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

proposal: option to not follow symlinks when copying assets

See original GitHub issue

Checklist

  • I am using the latest version of this aciton.
  • 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 proposal

At the moment the copyAssets step follows all symlinks to fetch their content:

https://github.com/peaceiris/actions-gh-pages/blob/2decf4e752abab9095efc5ace22a0e92ae2e6fec/src/git-utils.ts#L60

(The -L switch enables this behaviour.)

I would actually like to deploy a symlink to my gh-pages environment rather than copy the contents.

Describe the solution you’d like

Could we add a followSymlinks option, which defaults to true to keep existing behavior.

If set to false, copyAssets uses -P switch instead of -L.

I want to use followSymlinks: false plus keepFiles: true to create a CI job which updates a symlink and does nothing else.

Describe alternatives you’ve considered

Additional context

In fact, I am actually attempting to create the symlink in a CI job, and it’s creating an interesting failure:

https://github.com/PyO3/pyo3/runs/3278446262?check_suite_focus=true

The relevant log is:

  [INFO] first deployment, create new branch gh-pages
  [INFO] no such file or directory: /home/runner/work/pyo3/pyo3/public/latest
  [INFO] chdir /home/runner/actions_github_pages_1628498412192
  /usr/bin/git init
  Reinitialized existing Git repository in /home/runner/actions_github_pages_1628498412192/.git/
  /usr/bin/git checkout --orphan gh-pages
  fatal: A branch named 'gh-pages' already exists.

Looks like the copyAssets step fails because this symlink is dangling in the local checkout. This then causes the action to try to initialize a new gh-pages branch, which is incorrect and causes a crash.

So there’s maybe also a separate bug here about failure in the copyAssets step causing the action to incorrectly switch to first-deployment mode.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
kousucommented, Nov 3, 2021

Also looking forward to this!

I was using https://github.com/crazy-max/ghaction-github-pages/tree/v2 and didn’t think much about how it handled symlinks.

I just tried upgrading to this action instead because it handles .nojekyll and CNAME inline, and pushes commits on top instead of wiping and repushing the entire gh-pages branch every time, and tags the deployed commit ID in the gh-pages commit it makes, and generally seems better supported, but I did immediately notice that it copied instead of symlinked this file: https://github.com/neuropoly/neuropoly-docs/commit/f371d46e964105a54ac43a92355e499236168b8c#diff-0eb547304658805aad788d320f10bf1f292797b5e6d745a3bf617584da017051

So, also very much looking forward to this!

And thanks for making such a tidy and well-supported Action 😃

1reaction
vuldercommented, Nov 2, 2021

This feature sounds great 🎉 Deploying symlinks instead of copying the complete folder would help us a lot to simplify our setup and would also save a bit CI time. Looking forward to it 😍.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven Resources Plugin symbolic link handling
Unfortunately, there's not (yet) a configuration option. Introducing it (and defaulting it to “follow symlinks” instead of copy-preserving them) would fix ...
Read more >
Symbolic Link Handling
Copy (Client only): Copy only the symbolic link. If a file with the same name exists at the destination, the symbolic link does...
Read more >
Symbolic link - Wikipedia
In computing, a symbolic link is a file whose purpose is to point to a file or directory (called the "target") by specifying...
Read more >
API - esbuild
This API call is used by the command-line interface if no input files are provided and the --bundle flag is not present. In...
Read more >
New in Symfony 2.6: Smarter assets:install command
Although developers usually execute the command without any option, most of the time it's better to execute it with the --symlink option. This ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found