Forgejo drop-in for actions/labeler: label PRs by changed-file globs from a config file, via the Forgejo API. No github.com.
  • JavaScript 82.3%
  • Shell 13.1%
  • Makefile 4.6%
Find a file
Stephen Way d597433b84
All checks were successful
test / unit (push) Successful in 5s
Initial release: forgejo-labeler-action
Label pull requests by their changed files, matched against a config of
label -> glob patterns, via the Forgejo API. A drop-in for
actions/labeler with no github.com. Flat YAML or JSON config; globs
support *, ?, **, literal paths. sync-labels removes configured labels
that no longer match; missing labels are auto-created.

node20 action with pure config-parse + match cores. Offline suite:
config/match unit test plus an integration run against an in-memory mock
(add, skip-existing, sync-remove).
2026-05-31 20:13:11 -07:00
.forgejo Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
src Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
tests Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
.gitignore Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
action.yml Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
CHANGELOG.md Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
LICENSE Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
Makefile Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
MIGRATION.md Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00
README.md Initial release: forgejo-labeler-action 2026-05-31 20:13:11 -07:00

Forgejo Labeler

Forgejo's actions/labeler. Apply labels to a pull request based on which files it changes, matched against a config of label -> glob patterns, via the Forgejo API. No github.com.

Part of the Fjord Actions bundle.

Usage

.forgejo/labeler.yml:

frontend:
  - 'web/**'
  - '**/*.css'
docs:
  - 'docs/**'
  - '**/*.md'
ci:
  - '.forgejo/**'

Workflow:

on:
  pull_request:

permissions:
  pull-requests: write

jobs:
  label:
    runs-on: [self-hosted, Linux]
    steps:
      - uses: actions/checkout@v6
      - uses: https://rasterhub.com/rasterstate/forgejo-labeler-action@v1
        with:
          sync-labels: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}   # a Forgejo token on Forgejo

Config

A flat map of label -> glob patterns. A label applies when any of its patterns matches any changed file in the PR. YAML (indented list or inline array) and JSON both work:

docs: ['docs/**', '*.md']     # inline array
ci: '.forgejo/**'             # single value

Globs support * (within a path segment), ?, ** (across segments), and literal paths. Nested matcher objects (any-glob-to-any-file, all-globs-to-...) are not supported, use flat glob lists.

Inputs

Input Default Description
configuration-path .forgejo/labeler.yml Path to the label -> globs config.
sync-labels false Remove configured labels that no longer match.
pr-number from context PR to label (defaults to the event's pull_request).
token GITHUB_TOKEN env Forgejo token with PR write.
repository GITHUB_REPOSITORY Target repo.
api_url derived Forgejo API base.

Outputs

Output Description
new-labels JSON array of labels added this run.
all-labels JSON array of the PR's labels after this run.

Labels referenced in the config that don't exist yet are created automatically.

See MIGRATION.md for differences from actions/labeler.

License

MIT, see LICENSE.