GitHub.Actions.Glob 8.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package GitHub.Actions.Glob --version 8.0.2                
NuGet\Install-Package GitHub.Actions.Glob -Version 8.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GitHub.Actions.Glob" Version="8.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GitHub.Actions.Glob --version 8.0.2                
#r "nuget: GitHub.Actions.Glob, 8.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GitHub.Actions.Glob as a Cake Addin
#addin nuget:?package=GitHub.Actions.Glob&version=8.0.2

// Install GitHub.Actions.Glob as a Cake Tool
#tool nuget:?package=GitHub.Actions.Glob&version=8.0.2                

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="GitHub.Actions.Glob" />

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
}

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 147 9/20/2024
8.1.0 209 8/3/2024
8.0.16 94 6/11/2024
8.0.15 480 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 111 1/25/2024
8.0.4 107 1/23/2024
8.0.3 214 11/26/2023
8.0.2 128 11/26/2023
8.0.1 142 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