GitHub.Actions.Glob
8.1.1
dotnet add package GitHub.Actions.Glob --version 8.1.1
NuGet\Install-Package GitHub.Actions.Glob -Version 8.1.1
<PackageReference Include="GitHub.Actions.Glob" Version="8.1.1" />
paket add GitHub.Actions.Glob --version 8.1.1
#r "nuget: GitHub.Actions.Glob, 8.1.1"
// Install GitHub.Actions.Glob as a Cake Addin #addin nuget:?package=GitHub.Actions.Glob&version=8.1.1 // Install GitHub.Actions.Glob as a Cake Tool #tool nuget:?package=GitHub.Actions.Glob&version=8.1.1
GitHub.Actions.Glob
package
To install the GitHub.Actions.Glob
NuGet package:
<PackageReference Include="GitHub.Actions.Glob" Version="[Version]" />
Or use the dotnet add package
.NET CLI command:
dotnet add package GitHub.Actions.Glob
Get the IGlobPatternResolverBuilder
instance
To use the IGlobPatternResolverBuilder
in your .NET project, register the services with an IServiceCollection
instance by calling AddGitHubActionsGlob
and then your consuming code can require the IGlobPatternResolverBuilder
via constructor dependency injection.
using Microsoft.Extensions.DependencyInjection;
using Actions.Glob;
using Actions.Glob.Extensions;
using var provider = new ServiceCollection()
.AddGitHubActionsGlob()
.BuildServiceProvider();
var glob = provider.GetRequiredService<IGlobPatternResolverBuilder>();
GitHub.Actions.Glob
This was modified, but borrowed from the glob/README.md.
You can use this package to search for files matching glob patterns.
Basic usage
Relative paths and absolute paths are both allowed. Relative paths are rooted against the current working directory.
using Actions.Glob;
using Actions.Glob.Extensions;
var patterns = new[] { "**/tar.gz", "**/tar.bz" };
var globber = Globber.Create(patterns);
var files = globber.GlobFiles();
Get all files recursively
using Actions.Glob;
using Actions.Glob.Extensions;
var globber = Globber.Create("**/*");
var files = globber.GlobFiles();
Iterating files
When dealing with a large amount of results, consider iterating the results as they are returned:
using Actions.Glob;
using Actions.Glob.Extensions;
var globber = Globber.Create("**/*");
foreach (var file in globber.GlobFiles())
{
// Do something with the file
}
Recommended action inputs
When an action allows a user to specify input patterns, it is generally recommended to allow users to opt-out from following symbolic links.
Snippet from action.yml
:
inputs:
files:
description: "Files to print"
required: true
And corresponding toolkit consumption:
using Microsoft.Extensions.DependencyInjection;
using Actions.Core;
using Actions.Core.Extensions;
using Actions.Glob;
using Actions.Glob.Extensions;
using var provider = new ServiceCollection()
.AddGitHubActionsCore()
.BuildServiceProvider();
var core = provider.GetRequiredService<ICoreService>();
var globber = Globber.Create(core.GetInput("files"))
foreach (var file in globber.GlobFiles())
{
// Do something with the file
}
Pattern formats
The patterns that are specified in the AddExclude
and AddInclude
methods can use the following formats to match multiple files or directories.
Exact directory or file name
some-file.txt
path/to/file.txt
Wildcards
*
in file and directory names that represent zero to many characters not including separator characters.Value Description *.txt
All files with .txt file extension. *.*
All files with an extension. *
All files in top-level directory. .*
File names beginning with '.'. *word*
All files with 'word' in the filename. readme.*
All files named 'readme' with any file extension. styles/*.css
All files with extension '.css' in the directory 'styles/'. scripts/*/*
All files in 'scripts/' or one level of subdirectory under 'scripts/'. images*/*
All files in a folder with name that is or begins with 'images'. Arbitrary directory depth (
/**/
).Value Description **/*
All files in any subdirectory. dir/**/*
All files in any subdirectory under 'dir/'. Relative paths.
To match all files in a directory named "shared" at the sibling level to the base directory, use
../shared/*
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Pathological.Globbing (>= 8.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.1.1 | 140 | 9/20/2024 |
8.1.0 | 204 | 8/3/2024 |
8.0.16 | 94 | 6/11/2024 |
8.0.15 | 470 | 5/7/2024 |
8.0.14 | 97 | 4/30/2024 |
8.0.13 | 119 | 4/8/2024 |
8.0.12 | 146 | 3/6/2024 |
8.0.11 | 170 | 2/2/2024 |
8.0.10 | 106 | 1/31/2024 |
8.0.9 | 98 | 1/29/2024 |
8.0.8 | 115 | 1/27/2024 |
8.0.7 | 109 | 1/25/2024 |
8.0.4 | 107 | 1/23/2024 |
8.0.3 | 214 | 11/26/2023 |
8.0.2 | 126 | 11/26/2023 |
8.0.1 | 139 | 11/22/2023 |
8.0.0 | 135 | 11/18/2023 |
8.0.0-rc.1.23419.4 | 93 | 9/14/2023 |
1.0.0 | 215 | 12/7/2022 |