Skip to content

Conversation

@joshmgross
Copy link
Contributor

@joshmgross joshmgross commented Aug 15, 2024

This PR adds an option to the glob package to exclude hidden files. This includes:

  1. Any directory starting with .
  2. Any file starting with .
  3. Any files within a directory starting with .

This currently does not check for the hidden attribute that can be set on Windows files. Based on the discussion in nodejs/node#38809, this isn't natively supported in Node at the moment.
I'm open to working around that limitation, but the primary focus here is for files and directories that use the . naming convention.

/**
* Indicates whether to include hidden files (files and directories starting with a `.`).
*
* @default false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want the default behavior to be to exclude?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want the default to be exclude for the action that consumes this library, I don't think we need or should make a breaking change in this library.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense for changes to the glob package to be backward compatible but just curious, what other actions use this package? Are there any actions other than upload-artifact where we would want to pass true?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the comment should read "Indicates whether to exclude hidden files.."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any actions other than upload-artifact where we would want to pass true?

https://github.com/actions/toolkit/network/dependents?owner=actions&dependent_type=REPOSITORY&owner=actions

I see actions/deploy-pages, actions/upload-artifact, and actions/download-artifact.

continue
}

// Hidden file or directory?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What upload-artifact version(s) is this code path exercised in?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshmgross joshmgross marked this pull request as ready for review August 15, 2024 19:33
@joshmgross joshmgross requested a review from a team as a code owner August 15, 2024 19:33
@@ -1,6 +1,6 @@
{
"name": "@actions/glob",
"version": "0.4.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the releases file if you are going to bump in this pr as well
https://github.com/actions/toolkit/blob/main/packages/glob/RELEASES.md

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No other changes outside of this, some test fixes, and package bumps for security reasons
https://github.com/actions/toolkit/commits/main/packages/glob

Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joshmgross joshmgross merged commit 50f2977 into main Aug 15, 2024
@joshmgross joshmgross deleted the joshmgross/glob-ignore-hidden-files branch August 15, 2024 21:13
await createHiddenDirectory(path.join(root, '.emptyFolder'))
await createHiddenDirectory(path.join(root, '.folder'))
await createHiddenFile(path.join(root, '.file'), 'test .file content')
await fs.writeFile(
Copy link

@ramblingenzyme ramblingenzyme Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused about the behaviour here.

I'm not sure if the behaviour for the following globs matches what's intended

  • ignores-hidden-files/.folder - returns nothing
  • ignores-hidden-files/.folder/ - returns nothing
  • ignores-hidden-files/.folder/* - returns file
  • ignores-hidden-files/.folder/file - returns file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants