Repository navigation
ci: Add Auto-Label-ing Workflow #23758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jbylund
wants to merge
3
commits into
pantsbuild:main
Choose a base branch
from
jbylund:ci/pr-labeler
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # Configuration for .github/workflows/labeler.yaml (https://github.com/actions/labeler). | ||
| # | ||
| # Labels are only ever added, never removed. The labels that satisfy the release-notes check | ||
| # (`release-notes:not-required` and `category:internal`) are deliberately never applied here: whether | ||
| # a change needs release notes is a human decision, and an added label would stay even if later | ||
| # pushes made the PR user-facing. | ||
|
|
||
| # If a PR would gain more than this many labels from the rules below, it gains none of them. This | ||
| # keeps tree-wide refactors from collecting a label for every backend they happen to touch. | ||
| changed-files-labels-limit: 3 | ||
|
|
||
| "backend: Adhoc": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/adhoc/** | ||
| - src/python/pants/backend/experimental/adhoc/** | ||
|
|
||
| "backend: CC": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/cc/** | ||
| - src/python/pants/backend/experimental/cc/** | ||
|
|
||
| "backend: Docker": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/docker/** | ||
| - src/python/pants/backend/experimental/docker/** | ||
|
|
||
| "backend: Environments": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/core/environments/** | ||
|
|
||
| "backend: Go": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/go/** | ||
| - src/python/pants/backend/experimental/go/** | ||
|
|
||
| "backend: Helm": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/helm/** | ||
| - src/python/pants/backend/experimental/helm/** | ||
|
|
||
| "backend: JavaScript": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/javascript/** | ||
| - src/python/pants/backend/typescript/** | ||
| - src/python/pants/backend/jsx/** | ||
| - src/python/pants/backend/tsx/** | ||
| - src/python/pants/backend/experimental/javascript/** | ||
| - src/python/pants/backend/experimental/typescript/** | ||
|
|
||
| "backend: JVM": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/jvm/** | ||
| - src/python/pants/backend/java/** | ||
| - src/python/pants/backend/kotlin/** | ||
| - src/python/pants/backend/scala/** | ||
| - src/python/pants/backend/experimental/java/** | ||
| - src/python/pants/backend/experimental/kotlin/** | ||
| - src/python/pants/backend/experimental/scala/** | ||
|
|
||
| "backend: OpenAPI": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/openapi/** | ||
| - src/python/pants/backend/experimental/openapi/** | ||
|
|
||
| "backend: Protobuf": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/codegen/protobuf/** | ||
| - src/python/pants/backend/experimental/codegen/protobuf/** | ||
|
|
||
| "backend: Python": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/python/** | ||
| - src/python/pants/backend/experimental/python/** | ||
|
|
||
| "backend: Rust": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/rust/** | ||
| - src/python/pants/backend/experimental/rust/** | ||
|
|
||
| "backend: Shell": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/shell/** | ||
|
|
||
| "backend: Swift": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/swift/** | ||
| - src/python/pants/backend/experimental/swift/** | ||
|
|
||
| "backend: Terraform": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/terraform/** | ||
| - src/python/pants/backend/experimental/terraform/** | ||
|
|
||
| "backend: Thrift": | ||
| - changed-files: | ||
| - any-glob-to-any-file: | ||
| - src/python/pants/backend/codegen/thrift/** | ||
| - src/python/pants/backend/experimental/codegen/thrift/** | ||
|
|
||
| # Only when every changed file is user-facing documentation (release notes do not count). | ||
| "category:documentation": | ||
| - changed-files: | ||
| - all-globs-to-all-files: | ||
| - "docs/docs/**" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # https://github.com/actions/labeler | ||
| # | ||
| # Adds labels to PRs based on the files they change. The rules are in .github/labeler.yml. Each run | ||
| # looks at the PR's whole diff, so a push that touches a new area adds its label. The labeler keeps no | ||
| # state between runs, so it also re-adds a matching label that someone removed by hand. | ||
|
|
||
| name: Label pull requests | ||
| on: | ||
| # `pull_request_target` rather than `pull_request`, so that PRs from forks get a token that can | ||
| # add labels. This is safe because nothing from the PR is checked out or run: the labeler lists | ||
| # the changed files through the API and reads .github/labeler.yml from the base branch. | ||
| pull_request_target: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
| - ready_for_review | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| label: | ||
| name: Label from changed files | ||
| if: github.repository_owner == 'pantsbuild' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read # read .github/labeler.yml | ||
| pull-requests: write # add labels to the PR | ||
| steps: | ||
| - uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In spite of the comment, pull_request_target is unambiguously the largest source of CI security issues.
https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target#default-policy-for-pull_request_target
They're also quirky: https://github.com/actions/labeler#notes-regarding-pull_request_target-event
Do we really need it? What about a daily cron or something? I'm not too concerned about it on day 1, but more like, day 100 if someone mods it.