@actions/glob is too greedy
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
@actions/glob with ./some/path/* expands recursively, but it shouldn't
To Reproduce
Open List packages:
https://github.com/KidsKilla/glob-issue-example/runs/8038474520?check_suite_focus=true
the code of actions/github-script@v6:
const path = require('path');
const inputsGlob = '/packages/*';
console.log('inputs.glob', inputsGlob);
const globber = await glob.create(inputsGlob, {followSymbolicLinks: false});
const fullPaths = await globber.glob();
console.log('fullPaths\n', fullPaths.join('\n'));
core.setOutput("fullPaths", JSON.stringify(fullPaths));
const baseNames = fullPaths.map(f => path.basename(f));
console.log('baseNames\n', baseNames.join('\n'));
core.setOutput("baseNames", JSON.stringify(baseNames));
Expected behavior
I expect there to be only
/home/runner/work/glob-issue-example/glob-issue-example/packages/a
/home/runner/work/glob-issue-example/glob-issue-example/packages/b
/home/runner/work/glob-issue-example/glob-issue-example/packages/c
but I see instead:
/home/runner/work/glob-issue-example/glob-issue-example/packages/a
/home/runner/work/glob-issue-example/glob-issue-example/packages/a/a.js
/home/runner/work/glob-issue-example/glob-issue-example/packages/b
/home/runner/work/glob-issue-example/glob-issue-example/packages/b/b.js
/home/runner/work/glob-issue-example/glob-issue-example/packages/b/bb.js
/home/runner/work/glob-issue-example/glob-issue-example/packages/c
/home/runner/work/glob-issue-example/glob-issue-example/packages/c/xxx
/home/runner/work/glob-issue-example/glob-issue-example/packages/c/xxx/xxx.js
Desktop (please complete the following information):
runs-on: ubuntu-20.04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the @actions/glob call from the List packages workflow and compare the output of glob.create('/packages/*', {followSymbolicLinks: false}) with the expected paths. Trace the glob implementation from glob.create to determine why nested files are returned, then verify that only the immediate package entries are listed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100