actions / actions/toolkit

Shall addPath expand "~" when adding a path?

Open
#511 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the enhancement
When I try to add path, e.g., "~/.cargo/bin" by echo "::add-path::~/.cargo/bin" or echo "::add-path::"~/.cargo/bin. I would expect one of the case would add /home/user/.cargo/bin prepended to path. However both case yields a literal "~/.caro/bin:..." as final results.

The issue it caused when ~ is added literally is, some of the program interact with $PATH without going through shell, wouldn't necessarily understand what ~ means. One example is a Rust program, mdbook when it spawn plugin/extension sub-processses, it would expect those to be under ~/.cargo/bin, however, it only work when the path is added as /home/<user>/.cargo/bin.

I do find a working workaround for this: echo "::add-path::$HOME/.cargo/bin" is doing the right thing.

Should addPath so something similar as default or provide an option for it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the addPath entry point and trace how the ::add-path:: command handles a path beginning with ~. Compare that behavior with the documented $HOME workaround and determine whether expansion should be the default or an option. Done means the chosen behavior is implemented and paths passed to processes contain the expected home-directory form.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.