Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,15 @@ inputs:
default: ""
exclude:
description: >-
Comma- or newline-separated wildcard patterns removing repositories from
repos: "*" discovery.
Comma- or newline-separated glob patterns removing repositories from
repos: "*" discovery, compared case-insensitively against owner/name
when the pattern has a "/" and against the name alone otherwise. A star
matches any run of characters, "?" one character, "[abc]" one of a set,
"[!abc]" or "[^abc]" one outside it, and one leading "!" negates the
pattern. Beyond those a pattern holds only letters, digits, ".", "-",
and "_", with at most one "/", nothing empty around it, and no side that
is just "." or ".."; anything else (a leading "./", a run of stars, a
regex token such as "(a)+") fails the run naming the fix.
required: false
default: ""
topics:
Expand Down
4 changes: 4 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion docs/operate/multi-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ Discovery takes six filter inputs that apply only to `repos: "*"`; setting any o
- `archived` defaults to `skip`, because settings writes fail on archived repositories; `archived: only` is mostly useful with `mode: check`.
- `forks` includes, excludes, or keeps only forks.
- `topics` keeps repositories carrying at least one listed topic, so a single marker topic can opt repositories in. It is unrelated to the `topics` settings section.
- `exclude` takes wildcard patterns where `*` matches anything: a pattern containing `/` is matched against the full `owner/name`, any other against the name alone, case-insensitively.
- `exclude` takes glob patterns, matched case-insensitively: a pattern containing `/` against the full `owner/name`, any other against the name alone.
- `*` matches any run of characters, `?` one character, `[abc]` one of a set, `[!abc]` or `[^abc]` one outside it.
- One leading `!` negates the pattern, so `!svc-*` drops everything except the services.
- Beyond those operators a pattern holds only name characters (letters, digits, `.`, `-`, `_`), at most one `/` with a non-empty glob on each side, and no side that is just `.` or `..`. Anything else (a leading `./`, a run of stars, a brace, a parenthesis, a backslash, a quote, a second `/`, a class holding `*`) fails the run before discovery starts, naming the fix, as does a class like `[z-a]`. The matcher is [picomatch](https://github.com/micromatch/picomatch), confined to that grammar.
- `affiliation` selects which relationships to the token's user qualify, passed to GitHub's `/user/repos` listing: `owner` (the default), `collaborator`, or `organization_member`. The list replaces the default, so widening discovery beyond owned repositories takes `owner,collaborator`.

## Fallback for repositories without a settings file
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ A list input (`sections`, `required-sections`, `repos`, `exclude`, `topics`, `af
| `visibility` | <p>Keeps only repositories of this visibility in repos: "*" discovery: all (default), public, private, or internal.</p> | `false` | `""` |
| `archived` | <p>Archived-repository policy for repos: "*" discovery: skip (default), include, or only.</p> | `false` | `""` |
| `forks` | <p>Fork policy for repos: "*" discovery: include (default), exclude, or only.</p> | `false` | `""` |
| `exclude` | <p>Comma- or newline-separated wildcard patterns removing repositories from repos: "*" discovery.</p> | `false` | `""` |
| `exclude` | <p>Comma- or newline-separated glob patterns removing repositories from repos: "*" discovery, compared case-insensitively against owner/name when the pattern has a "/" and against the name alone otherwise. A star matches any run of characters, "?" one character, "[abc]" one of a set, "[!abc]" or "[^abc]" one outside it, and one leading "!" negates the pattern. Beyond those a pattern holds only letters, digits, ".", "-", and "_", with at most one "/", nothing empty around it, and no side that is just "." or ".."; anything else (a leading "./", a run of stars, a regex token such as "(a)+") fails the run naming the fix.</p> | `false` | `""` |
| `topics` | <p>Comma- or newline-separated topics, of which repos: "*" discovery keeps the repositories carrying at least one.</p> | `false` | `""` |
| `affiliation` | <p>Comma- or newline-separated affiliations for repos: "*" discovery: owner (default), collaborator, or organization_member.</p> | `false` | `""` |
<!-- action-docs-inputs source="action.yml" -->
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/library.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ const renderExitCode = runRender(
| `discoverRepos` | function | The repositories a token can see, filtered |
| `DiscoveryFilters` | type | The filters: `visibility`, `archived`, `forks`, `affiliation`, `topics`, `exclude` |
| `DEFAULT_DISCOVERY_FILTERS` | const | The action's defaults |
| `compileExcludePattern` | function | One `exclude` glob compiled once, or the problem naming why it is unusable and the fix |
| `ExcludePattern` | type | A compiled `exclude` entry: the operator's text, the scope its slash chose, and the regex |
| `parseReposInput` | function | The `repos` input form: slugs, or `"*"` for discovery |
| `resolveCentralTargets` | function | The `<owner>/<name>.yml` files of a repos-dir as targets, with warnings for the files it skipped |
| `dedupeTargets` | function | Merge the central and the remote targets, central first; a remote target whose slug a central one already names is dropped with a notice |
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrading/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,12 @@ v3 tryList("/repos/o/r/labels", { perPage: 100 }) // re

Fix: add `tryList` to every `GitHubClient` double: answer the pages your `tryRequest` route table would (`per_page=N&page=K` from 1, until a page is short) and return their bodies as `{ data: [...] }`; a client over another transport returns each page's body as received, and honors `until` by stopping after the first page it accepts.

## 61. Discovery: `exclude` patterns are globs under an owned grammar

For every `repos: "*"` workflow that sets `exclude`, and for `@vivswan/github-settings-as-code` consumers building `DiscoveryFilters`. In v2 an `exclude` pattern knew one operator, `*`, and matched every other character literally, so a `?`, a `[`, or a leading `!` could only ever match nothing. In v3 the pattern is a glob matched by picomatch inside a grammar the input boundary owns: `*` any run of characters, `?` one character, `[abc]` one of a set, `[!abc]` or `[^abc]` one outside it, one leading `!` negating the whole pattern, and beyond those only name characters (letters, digits, `.`, `-`, `_`) with at most one `/`; the scope rule is unchanged (a pattern with `/` matches `owner/name`, any other the name alone, case-insensitively). A pattern that gains glob meaning matched nothing in v2 and matches now: `exclude: "!svc-*"` discovered every repository, and now excludes every one whose name is not `svc-*` (`notice: repos: "*" discovery skipped 2 repositories by exclude pattern "!svc-*": o/tooling, o/website`). A pattern outside the grammar (a leading `./`, a run of stars, a `.` or `..` side, a second `/`, a doubled `!!`, a regex token such as `(a)+`) is your input, so it fails the run before discovery starts, naming every flaw and its fix, never repaired: `exclude: "./tmp-**"` matched nothing in v2 and now exits with `error: the "exclude" input pattern "./tmp-**" is not a usable glob: it starts with "./", which names no owner, so drop every leading "./", and it holds a run of stars, which matches no more than one "*" does, so write one "*". Write ...`.

Fix: delete a pattern that relied on `?`, `[`, `]`, or `!` matching literally, since it never matched a repository; rewrite one that meant a glob in the grammar above, following the fix each refusal names. For library callers, `DiscoveryFilters.exclude` takes compiled `ExcludePattern` values instead of strings: run each pattern through `compileExcludePattern` at your input boundary and pass the `Result`'s value.

## Order of operations

1. Rename any settings file whose path contains a comma, rename `undeclared` to `_undeclared` in every settings file, and move every other underscore key into a YAML comment; the v2 line accepts the old spellings only, so do all three together with the pin move.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"consola": "3.4.2",
"neverthrow": "8.2.0",
"picocolors": "1.1.1",
"picomatch": "4.0.7",
"yaml": "2.9.1",
"zod": "4.6.5"
},
Expand All @@ -90,6 +91,7 @@
"@octokit/openapi-webhooks": "12.1.0",
"@types/bun": "1.4.2",
"@types/node": "26.6.4",
"@types/picomatch": "4.0.3",
"action-docs": "2.5.1",
"ajv": "8.20.0",
"ajv-formats": "3.0.1",
Expand Down
Loading
Loading