Skip to content

:octocat: Github action to match glob patterns with support for matching deleted files.

License

Notifications You must be signed in to change notification settings

vk-gh-actions-forks/glob

 
 

Repository files navigation

Codacy Badge Codacy Badge build-test Update release version. Public workflows that use this action.

Ubuntu Mac OS Windows

glob

Search for files matching glob patterns with support for returning matching deleted git tracked files and also excludes all files and folders specified in .gitignore and the .git directory.

Usage

NOTE: ⚠️

...
    steps:
      - uses: actions/checkout@v2

      - name: Glob match
        uses: tj-actions/glob@v16
        id: glob
        with:
          files: |
            *.md
            **/*.yaml
            !action.yml
            **/rebase.yml

      - name: Show all matching files
        run: |
          echo "${{ steps.glob.outputs.paths }}"
        # Outputs: .github/workflows/rebase.yml .github/workflows/sync-release-version.yml .github/workflows/test.yml...

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
base-ref string false "${{ github.event.pull_request.base.ref }}" Specify a base ref used for
comparing changes, when include-deleted-files is set
to true
base-sha string false Specify a base commit SHA used
for comparing changes, when include-deleted-files is
set to true
diff string false Specify a diff string .. or
... used for comparing changes, when
include-deleted-files is set to true
escape-paths string false "false" Escape special characters of filenames used
in the paths output
excluded-files string false Excluded file patterns (optionally include !
before the file pattern or it
would be prepended)
excluded-files-from-source-file string false Source file to populate the excluded-files
input
excluded-files-from-source-file-separator string false "\n" Separator used to split the excluded-files-from-source-file
input
excluded-files-separator string false "\n" Separator used to split the excluded-files
input
files string false File patterns
files-from-source-file string false Source file to populate the files
input
files-from-source-file-separator string false "\n" Separator used to split the files-from-source-file
input
files-separator string false "\n" Separator used to split the files
input
follow-symbolic-links string true "true" Indicates whether to follow symbolic links
head-repo-fork string false "${{ github.event.pull_request.head.repo.fork }}" Specify a boolean indicating a PR
from a fork is used for
comparing changes, when include-deleted-files is set
to true
include-deleted-files string false "false" Include all matching deleted files
match-directories string true "true" Indicates whether to include match directories
match-gitignore-files string true "false" Indicates whether to match files in
.gitignore
separator string true " " Separator used for the paths output.
sha string true "${{ github.sha }}" Specify a current commit SHA used
for comparing changes, when include-deleted-files is
set to true
strip-top-level-dir string false "true" Strip the $GITHUB_WORKSPACE from the paths
output
working-directory string true "." Specify a relative path under $GITHUB_WORKSPACE
to locate the repository

Outputs

OUTPUT TYPE DESCRIPTION
has-custom-patterns string Indicates whether custom patterns were used
paths string List of filtered paths using the
specified patterns and separator
paths-output-file string List of filtered paths using the
specified patterns and separator stored in
a temporary file

Patterns

Glob behavior

Patterns *, ?, [...], ** (globstar) are supported.

With the following behaviors:

  • File names that begin with . may be included in the results
  • Case insensitive on Windows
  • Directory separator / and \ both supported on Windows

Tilde expansion

Supports basic tilde expansion, for current user HOME replacement only.

Example:

  • ~ may expand to /Users/johndoe
  • ~/foo may expand to /Users/johndoe/foo

Comments

Patterns that begin with # are treated as comments.

Exclude patterns

Leading ! changes the meaning of an include pattern to exclude.

Multiple leading ! flips the meaning.

Escaping

Wrapping special characters in [] can be used to escape literal glob characters in a file name. For example the literal file name hello[a-z] can be escaped as hello[[]a-z].

On Linux/macOS \ is also treated as an escape character.

If you feel generous and want to show some extra appreciation:

Buy me a coffee

Credits

This package was created with Cookiecutter using cookiecutter-action

Report Bugs

Report bugs at https://github.com/tj-actions/glob/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your workflow that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

About

:octocat: Github action to match glob patterns with support for matching deleted files.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.9%
  • JavaScript 2.1%