-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Changes from all commits
712ce1b
b617c28
f8283b9
ea32451
c044e59
09f6d49
58078a5
a710e01
0034a44
48b2e33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@actions/glob", | ||
"version": "0.4.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
"version": "0.5.0", | ||
"preview": true, | ||
"description": "Actions glob lib", | ||
"keywords": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,13 @@ export interface GlobOptions { | |
* @default true | ||
*/ | ||
omitBrokenSymbolicLinks?: boolean | ||
|
||
/** | ||
* Indicates whether to exclude hidden files (files and directories starting with a `.`). | ||
* This does not apply to Windows files and directories with the hidden attribute unless | ||
* they are also prefixed with a `.`. | ||
* | ||
* @default false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we want the default behavior to be to exclude? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: the comment should read "Indicates whether to exclude hidden files.." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see |
||
*/ | ||
excludeHiddenFiles?: boolean | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,11 @@ export class DefaultGlobber implements Globber { | |
continue | ||
} | ||
|
||
// Hidden file or directory? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What upload-artifact version(s) is this code path exercised in? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Glob is utilized here https://github.com/actions/upload-artifact/blob/main/src/shared/search.ts |
||
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) { | ||
continue | ||
} | ||
|
||
// Directory | ||
if (stats.isDirectory()) { | ||
// Matched | ||
|
There was a problem hiding this comment.
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 nothingignores-hidden-files/.folder/
- returns nothingignores-hidden-files/.folder/*
- returnsfile
ignores-hidden-files/.folder/file
- returnsfile