GitHub.Actions.Glob
1.0.0
See the version list below for details.
dotnet add package GitHub.Actions.Glob --version 1.0.0
NuGet\Install-Package GitHub.Actions.Glob -Version 1.0.0
<PackageReference Include="GitHub.Actions.Glob" Version="1.0.0" />
paket add GitHub.Actions.Glob --version 1.0.0
#r "nuget: GitHub.Actions.Glob, 1.0.0"
// Install GitHub.Actions.Glob as a Cake Addin #addin nuget:?package=GitHub.Actions.Glob&version=1.0.0 // Install GitHub.Actions.Glob as a Cake Tool #tool nuget:?package=GitHub.Actions.Glob&version=1.0.0
GitHub Actions.Glob
.NET SDK
The .NET equivalent of the official GitHub actions/toolkit @actions/glob
project.
Blog
🔗 Hello from the GitHub Actions.Glob
.NET SDK
Usage
Installing the NuGet package 📦
Welcome to the Actions.Glob
.NET SDK. This SDK is used to create GitHub Actions in .NET. The SDK is a thin wrapper around the .NET implementation of the GitHub Actions a select few packages from the @actions/toolkit
.
Warning: This package is not an official Microsoft or GitHub product. It is a community-driven project.
You"ll need to install the GitHub Actions.Glob
.NET SDK NuGet package to use the .NET APIs. The package is available on NuGet.org. The following is the command to install the package:
Adding package references
Either add the package reference to your project file:
<PackageReference Include="Actions.Glob" Version="0.0.1" />
Or use the dotnet add package
.NET CLI command:
dotnet add package 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>();
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 | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
- Microsoft.Extensions.FileSystemGlobbing (>= 7.0.0)
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 | 136 | 9/20/2024 |
8.1.0 | 202 | 8/3/2024 |
8.0.16 | 93 | 6/11/2024 |
8.0.15 | 463 | 5/7/2024 |
8.0.14 | 96 | 4/30/2024 |
8.0.13 | 118 | 4/8/2024 |
8.0.12 | 145 | 3/6/2024 |
8.0.11 | 169 | 2/2/2024 |
8.0.10 | 105 | 1/31/2024 |
8.0.9 | 97 | 1/29/2024 |
8.0.8 | 114 | 1/27/2024 |
8.0.7 | 108 | 1/25/2024 |
8.0.4 | 106 | 1/23/2024 |
8.0.3 | 213 | 11/26/2023 |
8.0.2 | 125 | 11/26/2023 |
8.0.1 | 138 | 11/22/2023 |
8.0.0 | 134 | 11/18/2023 |
8.0.0-rc.1.23419.4 | 92 | 9/14/2023 |
1.0.0 | 214 | 12/7/2022 |