# @actions/glob

> Actions glob lib

Latest version **0.7.0** (published 2026-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @actions/glob
pnpm add @actions/glob
yarn add @actions/glob
bun add @actions/glob
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2026-04-21 |
| First published | 2020-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 78.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5855 |
| Maintainers | bryanmacfarlane, thboop, ericsciple, bdehamer |
| Keywords | github, actions, glob |

## Links

- npm: https://www.npmjs.com/package/@actions/glob
- Repository: https://github.com/actions/toolkit
- Homepage: https://github.com/actions/toolkit/tree/main/packages/glob
- Issues: https://github.com/actions/toolkit/issues
- npm.io page: https://npm.io/package/@actions/glob

## Dependencies (2)

- [minimatch](https://npm.io/package/minimatch.md) ^10.2.5
- [@actions/core](https://npm.io/package/@actions/core.md) ^3.0.0

## Recent versions

- 0.7.0 (latest) — 2026-04-21
- 0.6.1 — 2026-01-29
- 0.6.0 — 2026-01-29
- 0.5.1 — 2026-01-27
- 0.5.0 — 2024-08-15
- 0.4.0 — 2023-01-25
- 0.3.0 — 2022-04-18
- 0.2.1 — 2022-03-17
- 0.2.0 — 2021-06-07
- 0.1.2 — 2021-05-21
- 0.1.1 — 2020-11-13
- 0.1.0 — 2020-01-10

## README

# `@actions/glob`

## Usage

### Basic

You can use this package to search for files matching glob patterns.

Relative paths and absolute paths are both allowed. Relative paths are rooted against the current working directory.

```js
const glob = require('@actions/glob');

const patterns = ['**/tar.gz', '**/tar.bz']
const globber = await glob.create(patterns.join('\n'))
const files = await globber.glob()
```

### Opt out of following symbolic links

```js
const glob = require('@actions/glob');

const globber = await glob.create('**', {followSymbolicLinks: false})
const files = await globber.glob()
```

### Iterator

When dealing with a large amount of results, consider iterating the results as they are returned:

```js
const glob = require('@actions/glob');

const globber = await glob.create('**')
for await (const file of globber.globGenerator()) {
  console.log(file)
}
```

## Recommended action inputs

Glob follows symbolic links by default. Following is often appropriate unless deleting files.

Users may want to opt-out from following symbolic links for other reasons. For example,
excessive amounts of symbolic links can create the appearance of very, very many files
and slow the search.

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`:

```yaml
inputs:
  files:
    description: 'Files to print'
    required: true
  follow-symbolic-links:
    description: 'Indicates whether to follow symbolic links'
    default: true
```

And corresponding toolkit consumption:

```js
const core = require('@actions/core')
const glob = require('@actions/glob')

const globOptions = {
  followSymbolicLinks: core.getInput('follow-symbolic-links').toUpper() !== 'FALSE'
}
const globber = glob.create(core.getInput('files'), globOptions)
for await (const file of globber.globGenerator()) {
  console.log(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.

---
_Source: https://npm.io/package/@actions/glob · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
