Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
119 changes: 119 additions & 0 deletions .github/labeler.yml
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/**"
30 changes: 30 additions & 0 deletions .github/workflows/labeler.yaml
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:

@sureshjoshi sureshjoshi Nov 14, 2026 •

Copy link
Copy Markdown
Member

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.

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
Loading