Skip to content

@actions/glob: extend hashFiles options#2357

Open
priyagupta108 wants to merge 3 commits intoactions:mainfrom
priyagupta108:glob-hashfiles-options
Open

@actions/glob: extend hashFiles options#2357
priyagupta108 wants to merge 3 commits intoactions:mainfrom
priyagupta108:glob-hashfiles-options

Conversation

@priyagupta108
Copy link
Copy Markdown

This pull request extends @actions/glob hashFiles to support safer and more flexible hashing by adding options for allowed roots, an opt-in to include files outside those roots (allowFilesOutsideWorkspace), and exclude patterns (exclude).

Closes #1035

@priyagupta108 priyagupta108 marked this pull request as ready for review March 24, 2026 07:04
@priyagupta108 priyagupta108 requested a review from a team as a code owner March 24, 2026 07:04
Copilot AI review requested due to automatic review settings March 24, 2026 07:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Extends @actions/glob’s hashFiles to allow hashing files outside the workspace in a safer, more configurable way (root allowlist + opt-in outside-root inclusion + exclude patterns), addressing the limitations described in #1035.

Changes:

  • Add HashFileOptions fields: roots, allowFilesOutsideWorkspace, and exclude.
  • Update internal-hash-files to enforce root allowlisting using realpaths (symlink-safe) and support exclude filtering + outside-root warnings.
  • Add test coverage and README documentation for the new options.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/glob/src/internal-hash-files.ts Implements root allowlist checks, exclude pattern matching, and outside-root behavior/warnings.
packages/glob/src/internal-hash-file-options.ts Adds new public hashFiles options to the HashFileOptions interface.
packages/glob/src/glob.ts Wires the new options through to the internal hasher.
packages/glob/tests/hash-files.test.ts Adds tests for roots filtering, opt-in outside-root hashing, and exclude patterns.
packages/glob/README.md Documents hashFiles behavior and the newly added options.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Support hashing files outside the workspace directory

2 participants