Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add glob option to ignore hidden files #1791

Merged
merged 10 commits into from
Aug 15, 2024

Conversation

joshmgross
Copy link
Member

@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
Member 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
Member 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.

@@ -128,6 +128,11 @@ export class DefaultGlobber implements Globber {
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
14 checks passed
@joshmgross joshmgross deleted the joshmgross/glob-ignore-hidden-files branch August 15, 2024 21:13
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.

4 participants