Skip to content

Menu

CODEOWNERS and SPDX Cheat Sheet: Owners, Patterns and Licence IDs

Checked against GitHub CODEOWNERS and SPDX GitHub Docs (checked 28 Nov 2026), SPDX License List 3.29.0 (16 Sep 2026), SPDX spec 3.0.1 on 28 November 2026. Each section links to the official docs it was checked against.

Two small files that decide who reviews a change and what licence it ships under. This sheet covers GitHub's CODEOWNERS rules from the GitHub Docs and SPDX licence identifiers and expressions from the SPDX License List 3.29.0 and spec 3.0.1. We didn't push a CODEOWNERS file to a live repository for this page, so those rows are marked untested.

When to use what

Keep one CODEOWNERS file in .github/. GitHub looks in .github/, then the repository root, then docs/, and uses the first it finds, so a second copy elsewhere is ignored and only confuses people. Start with a catch-all * line for a default team, then add narrower paths below it, because the last matching line wins. Use teams rather than people so ownership survives someone leaving. CODEOWNERS only requests reviews; turn on "Require review from Code Owners" in branch protection or a ruleset if you want it enforced. Paste your file and some paths into the CODEOWNERS tester to see who owns what before you merge, and the glob pattern tester helps with trickier patterns.

For licences, always use an SPDX identifier instead of free text: MIT, Apache-2.0, GPL-3.0-or-later. For GNU licences pick -only or -or-later explicitly; the bare GPL-2.0 and GPL-3.0 IDs are deprecated. Use OR when users may choose, AND when they must comply with both, and WITH for an exception. The SPDX expression checker parses an expression and shows how it groups, and the licence generator writes the LICENSE file itself.

.github/CODEOWNERS

Preferred location; GitHub checks .github/, then root, then docs/ and uses the first file found

Try it: CODEOWNERS TesterFrom the docs, not run by us
* @acme/platform

Default owners for every file; put this line first so later lines override it

From the docs, not run by us

Owners can be an email address linked to a GitHub account

From the docs, not run by us
*.txt @octo-org/octocats

Assign a team; it must be visible and have write access to the repo

From the docs, not run by us
/.github/CODEOWNERS @acme/leads

Give the CODEOWNERS file itself an owner so nobody quietly edits ownership

From the docs, not run by us
/apps/ @octocat @hubot

List several owners on one line; any one approval satisfies the requirement

From the docs, not run by us

Patterns follow most .gitignore rules, but ! negation, [ ] character ranges and escaping # with a backslash are not supported. Invalid lines are skipped. Files over 3 MB are not loaded at all.

/build/logs/ @doctocat

Leading slash: only the build/logs folder at the repo root and everything under it

Try it: glob-pattern-testerFrom the docs, not run by us

Only files directly inside any docs folder, not deeper subfolders

From the docs, not run by us
apps/ @octocat

An apps folder anywhere in the tree, with all its contents

From the docs, not run by us
**/logs @octocat

Any logs folder at any depth

From the docs, not run by us
/apps/github

A pattern with no owner: that path needs no code owner review

From the docs, not run by us
*.js @js-owner # inline comment

Text after # is a comment; this later line beats an earlier *.js line

From the docs, not run by us

IDs are case-insensitive but use the canonical case from the list. Exceptions have their own list at https://spdx.org/licenses/exceptions-index.html.

MIT

MIT License, the usual permissive default for JavaScript packages

Apache-2.0

Apache License 2.0, permissive with an explicit patent grant

BSD-2-Clause / BSD-3-Clause

Simplified and New BSD licences

ISC / 0BSD

Short permissive licences; 0BSD drops the attribution requirement

MPL-2.0

Mozilla Public License 2.0, file-level copyleft

GPL-3.0-only / GPL-3.0-or-later

GPLv3, pinned to that version or allowing later ones; bare GPL-3.0 is deprecated

LGPL-2.1-or-later

Lesser GPL 2.1 or any later version

AGPL-3.0-only

Affero GPL v3, copyleft that also covers network use

Unlicense / CC0-1.0

Public-domain style dedications

Classpath-exception-2.0 / LLVM-exception

Exception IDs, only valid on the right of WITH

Precedence from tightest to loosest: +, WITH, AND, OR. Operators must be all upper or all lower case.

MIT OR Apache-2.0

Dual licence: the user may pick either

LGPL-2.1-only AND MIT AND BSD-2-Clause

Conjunction: the user must comply with all three

GPL-2.0-or-later WITH Bison-exception-2.2

Apply an exception to one licence; WITH needs spaces on both sides

MIT AND (LGPL-2.1-or-later OR BSD-3-Clause)

Parentheses override the default grouping

LGPL-2.1-only OR BSD-3-Clause AND MIT

Without brackets this means LGPL-2.1-only OR (BSD-3-Clause AND MIT)

EPL-1.0+

Plus suffix on a non-GNU ID: this version or later; no space before +

LicenseRef-Acme-EULA

Your own licence text that isn't on the SPDX list

// SPDX-License-Identifier: MIT

One-line source file header in the language's comment syntax

"license": "(MIT OR Apache-2.0)"

The same expression in a package.json license field

From the docs, not run by us

Worked example: Work out who reviews a change and what licence a file carries

A repository with this .github/CODEOWNERS:

*                 @acme/platform
*.ts              @acme/frontend
/packages/api/    @acme/backend
/packages/api/vendor/
/.github/         @acme/leads

Now a pull request touches four files:

packages/api/src/user.ts        -> @acme/backend
packages/web/src/App.ts         -> @acme/frontend
packages/api/vendor/lib.js      -> no code owner
.github/workflows/ci.yml        -> @acme/leads

The rule is last match wins. user.ts matches *, *.ts and /packages/api/, and the API line is lowest, so backend owns it even though it is a TypeScript file. If you wanted frontend to review every .ts file, the *.ts line would have to come after the API line. The vendor folder has a pattern with no owner, which removes the requirement for that path. These outcomes follow the documented rules; paste the file into the CODEOWNERS tester to check them against your own paths. For the licence side, user.ts starting with // SPDX-License-Identifier: Apache-2.0 OR MIT tells scanners the file is dual licensed and the user can choose either.

Common mistakes

  • Putting the catch-all * line at the bottom of CODEOWNERS.

    Put it first; because the last match wins, a final * line overrides every specific rule above it.

  • Writing owners on separate lines for the same pattern.

    List all owners on one line; repeating the pattern means only the last line's owners count.

  • Using !docs/** to exclude a folder, as in .gitignore.

    Negation isn't supported; add the path on its own line with no owner instead.

  • Assigning a team that only has read access and wondering why no review is requested.

    Give the team write access to the repository and make sure it is visible.

  • Writing GPL-3.0 or Apache 2 in package metadata.

    Use exact SPDX IDs such as GPL-3.0-or-later or Apache-2.0; free text and deprecated IDs confuse scanners.

  • Writing MIT or apache-2.0 With LLVM-exception with mixed-case operators.

    Use all-caps AND, OR and WITH; mixed case like With is invalid.