actions / actions/toolkit

[Documentation] Update exec.exec documentation to mention single quote limitation

Open
#1,382 2 comments 3 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

The current documentation of exec.exec does not mention the limitation
regarding single quotes and double quotes. In the current implementation,
only double quotes are supported for splitting arguments.

The documentation should be updated to include
this information to prevent confusion and save developers' time.

Current document on exec.exec is as follows.

https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/exec/src/exec.ts#L7-L16

 * @param     commandLine        command to execute (can include additional args). Must be correctly escaped.

This lacks information on single quotes and double quotes, only the latter of which is supported currently. I would like to append the information on the doc.

Code Snippet

 * @param     commandLine        command to execute (can include additional args). Must be correctly escaped. Currently, only double quotes are supported for splitting args.

Additional information

I spent many hours debugging the reason why the following code did not work as expected

exec.exec(`git config --local some.key 'some value with white space'`)

It is only after I read the internal code that I realized the root cause is the single quotes.
I believe the slight change on doc can prevent developers like me from failing into pitfalls.

https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/exec/src/toolrunner.ts#L568

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 with the exec.exec parameter documentation in packages/exec/src/exec.ts, then review the argument-splitting context referenced in packages/exec/src/toolrunner.ts. Update the documentation to state the current single-quote limitation, and confirm that the wording accurately reflects the implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.