ci: add workflow to auto-label PRs by changed paths#1158
Open
mr-raj12 wants to merge 1 commit intoasyncapi:masterfrom
Open
ci: add workflow to auto-label PRs by changed paths#1158mr-raj12 wants to merge 1 commit intoasyncapi:masterfrom
mr-raj12 wants to merge 1 commit intoasyncapi:masterfrom
Conversation
Adds .github/labeler.yml and .github/workflows/labeler.yml that use
actions/labeler@v5 to apply the repo's existing area/* labels to PRs
based on which files changed.
Mapping uses only labels that already exist on the repo:
- area/ci-cd for .github/**, .changeset/**, turbo.json
- area/docs for **/*.md and assets/**
- area/typescript for **/*.{ts,tsx}
- area/javascript for **/*.{js,cjs,mjs}
- dependencies for package.json and lockfiles
Both files are new, so this does not conflict with workflows that are
centrally managed in asyncapi/.github.
Refs asyncapi#1157
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Adds a new workflow that automatically applies the repo's existing
area/*labels to pull requests based on which files changed. Usesactions/labeler@v5with a path-to-label mapping file.Closes #1157.
Why
asyncapi/parser-jsalready has a richarea/*label taxonomy (area/javascript,area/typescript,area/docs,area/ci-cd,area/java,area/go,area/design), but nothing applies these labels to PRs automatically:dependencies+javascript(set by Dependabot itself).ci:PRs like ci: update of files from global .github repo #1149 — land with noarea/*label.add-good-first-issue-labels.ymlworkflow is comment-triggered (/gfi <area>) and only targets issues, not PRs.Result: maintainers either label PRs by hand or skip it, and filtering open PRs by area is unreliable.
Changes
Two new files (both are new, so this does not conflict with workflows centrally managed in
asyncapi/.github):.github/labeler.ymlPath-to-label mapping. Uses only labels that already exist on the repo:
area/ci-cd.github/**,.changeset/**,turbo.jsonarea/docs**/*.md,assets/**area/typescript**/*.ts,**/*.tsxarea/javascript**/*.js,**/*.cjs,**/*.mjsdependenciespackage.json,package-lock.json,packages/*/package.json.github/workflows/labeler.ymlRuns on
pull_request_target(required byactions/labelerso it haspull-requests: writeon PRs from forks) and callsactions/labeler@v5.sync-labels: trueremoves a label if a later push no longer matches — keeps labels honest as the PR evolves.Permissions are scoped to only what's needed:
Notes for reviewers
labeler.ymlis one the repo already uses.pull_request_targetis used (notpull_request) per theactions/labelerdocs, so PRs from forks can be labeled. The action only reads the PR diff; it does not check out or execute PR code.area/parser,area/multi-parser) but stuck to labels that already exist on the repo.