actions / actions/toolkit

@actions/glob is too greedy

Open
#1,167 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.