[llvm] workflows: Add a simple pull request subscription workflow (PR #64913)
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 21:17:30 PDT 2023
https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/64913:
>From f1687336d01a24345f0708278079c3e747dbea53 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Tue, 22 Aug 2023 14:44:12 -0700
Subject: [PATCH 1/2] workflows: Add a simple pull request subscription
workflow
This new workflows will make it possible for people to subscribe to
pull requests based on the files that are being modified. Whenever
a pull request is created, this action will look through all of
the teams whose name begins with pr-subscribers- and it will try
to match the files changed in the pull request to a comma separated
list of globs in the team's description.
One limitation of this workflow is that it only runs when a pull
request is created, so any files added in subsequent updates will
not create notifications for the appropriate teams. This is planned
to be fixed in a future update.
---
.github/workflows/pr-subscriber.yml | 27 +++++++++++++++++
llvm/utils/git/github-automation.py | 46 +++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
create mode 100644 .github/workflows/pr-subscriber.yml
diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml
new file mode 100644
index 000000000000000..a4c045a05635b2b
--- /dev/null
+++ b/.github/workflows/pr-subscriber.yml
@@ -0,0 +1,27 @@
+name: PR Subscriber
+
+on:
+ pull_request:
+ types:
+ - opened
+
+permissions:
+ contents: read
+
+jobs:
+ auto-subscribe:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup Automation Script
+ run: |
+ curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/github-automation.py
+ curl -O -L https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/llvm/utils/git/requirements.txt
+ chmod a+x github-automation.py
+ pip install -r requirements.txt
+
+ - name: Update watchers
+ run: |
+ ./github-automation.py \
+ --token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
+ pr-subscriber \
+ --issue-number '${{ github.event.pull_request.number }}'
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 1ec58fef573dcaf..30e1a4c49a951a5 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -9,6 +9,7 @@
# ==-------------------------------------------------------------------------==#
import argparse
+import fnmatch
from git import Repo # type: ignore
import github
import os
@@ -65,6 +66,43 @@ def run(self) -> bool:
return False
+class PRSubscriber:
+
+ class PRTeam:
+ def __init__(self, slug: str, description: str):
+ self.slug = slug
+ self.globs = [x.strip() for x in description.split(",")]
+
+ def __init__(self, token: str, repo: str, pr_number: int):
+ self.repo = github.Github(token).get_repo(repo)
+ self.org = github.Github(token).get_organization(self.repo.organization.login)
+ self.pr = self.repo.get_issue(pr_number).as_pull_request()
+ self.teams = []
+ for team in self.org.get_teams():
+ if not team.name.startswith("pr-subscribers-"):
+ continue
+ self.teams.append(PRSubscriber.PRTeam(team.slug, team.description))
+
+ def run(self) -> bool:
+ mentions = []
+ for c in self.pr.get_commits():
+ for f in c.files:
+ print(f.filename)
+ for t in self.teams:
+ for g in t.globs:
+ if len(fnmatch.filter([f.filename for f in c.files], g)):
+ print('Matches {} for {}'.format(g, t.slug))
+ mentions.append(t.slug)
+ break
+
+ if not len(mentions):
+ return False
+
+ comment = "\n".join(['@llvm/{}'.format(m) for m in mentions])
+ self.pr.as_issue().create_comment(comment)
+ return True
+
+
def setup_llvmbot_git(git_dir="."):
"""
Configure the git repo in `git_dir` with the llvmbot account so
@@ -506,6 +544,9 @@ def execute_command(self) -> bool:
issue_subscriber_parser.add_argument("--label-name", type=str, required=True)
issue_subscriber_parser.add_argument("--issue-number", type=int, required=True)
+pr_subscriber_parser = subparsers.add_parser("pr-subscriber")
+pr_subscriber_parser.add_argument("--issue-number", type=int, required=True)
+
release_workflow_parser = subparsers.add_parser("release-workflow")
release_workflow_parser.add_argument(
"--llvm-project-dir",
@@ -551,6 +592,11 @@ def execute_command(self) -> bool:
args.token, args.repo, args.issue_number, args.label_name
)
issue_subscriber.run()
+elif args.command == "pr-subscriber":
+ pr_subscriber = PRSubscriber(
+ args.token, args.repo, args.issue_number
+ )
+ pr_subscriber.run()
elif args.command == "release-workflow":
release_workflow = ReleaseWorkflow(
args.token,
>From 29997699491f50b2abd4a2451091b7df0c2ae0db Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Thu, 7 Sep 2023 21:14:40 -0700
Subject: [PATCH 2/2] Rewrite to key notifications off of labels instead of
file paths
The labels are added based on the file paths so we still ultimately end
up with file path based subscriptions, but using labels as an intermediary
gives us more flexibility.
---
.github/new-prs-labeler.yml | 819 +++++++++++++++++++++-------
.github/workflows/pr-subscriber.yml | 6 +-
llvm/utils/git/github-automation.py | 44 +-
3 files changed, 658 insertions(+), 211 deletions(-)
diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml
index 79bd72c8f6602a1..bc4a30a4802a7c3 100644
--- a/.github/new-prs-labeler.yml
+++ b/.github/new-prs-labeler.yml
@@ -1,91 +1,6 @@
-backend:AArch64:
- - llvm/include/llvm/IR/IntrinsicsAArch64.td
- - llvm/lib/Target/AArch64/**/*
- - llvm/test/**/*AArch64/**/*
- - clang/lib/Basic/Targets/AArch64*
- - clang/lib/Driver/ToolChains/Arch/AArch64*
- - clang/lib/CodeGen/Targets/AArch64.cpp
- - clang/include/clang/Basic/BuiltinsAArch64*
-
-backend:ARM:
- - llvm/include/llvm/IR/IntrinsicsARM.td
- - llvm/lib/Target/ARM/**/*
- - llvm/test/**/*ARM/**/*
- - clang/lib/Basic/Targets/ARM*
- - clang/lib/Driver/ToolChains/Arch/ARM*
- - clang/lib/CodeGen/Targets/ARM.cpp
- - clang/include/clang/Basic/BuiltinsARM*
-
-backend:DirectX:
- - llvm/include/llvm/IR/IntrinsicsDirectX.td
- - llvm/**/Target/DirectX/**/*
- - llvm/**/dxil-dis/**/*
- - clang/lib/Basic/Targets/DirectX*
-
-backend:MSP430:
- - llvm/include/llvm/IR/IntrinsicsMSP430.td
- - llvm/lib/Target/MSP430/**/*
- - llvm/test/**/MSP430/**/*
- - clang/lib/Basic/Targets/MSP430*
- - clang/lib/Driver/ToolChains/Arch/MSP430*
- - clang/lib/CodeGen/Targets/MSP430.cpp
- - clang/include/clang/Basic/BuiltinsMSP430*
-
-backend:RISC-V:
- - llvm/**/*RISCV*/**/*
- - llvm/**/*risv*/**/*
- - clang/**/*RISCV*/**/*
- - clang/**/*risv*/**/*
-
-backend:Sparc:
- - llvm/include/llvm/IR/IntrinsicsSparc.td
- - llvm/lib/Target/Sparc/**/*
- - llvm/test/**/Sparc/**/*
- - clang/lib/Basic/Targets/Sparc*
- - clang/lib/Driver/ToolChains/Arch/Sparc*
- - clang/lib/CodeGen/Targets/Sparc.cpp
- - clang/include/clang/Basic/BuiltinsSparc*
-
-backend:X86:
- - llvm/include/llvm/IR/IntrinsicsX86.td
- - llvm/include/llvm/Support/X86DisassemblerDecoderCommon.h
- - llvm/include/llvm/TargetParser/X86*
- - llvm/lib/TargetParser/X86*
- - llvm/**/**/X86/**/*
- - llvm/utils/TableGen/X86*
- - clang/lib/Basic/Targets/X86/**/*
- - clang/lib/Driver/ToolChains/Arch/X86.*
- - clang/lib/CodeGen/Targets/X86.*
- - clang/test/CodeGen/X86/**/*
- - clang/include/clang/Basic/BuiltinsX86*
-
-backend:loongarch:
- - llvm/include/llvm/IR/IntrinsicsLoongArch.td
- - llvm/lib/Target/LoongArch/**/*
- - llvm/test/**/LoongArch/**/*
- - clang/lib/Basic/Targets/LoongArch*
- - clang/lib/Driver/ToolChains/Arch/LoongArch*
- - clang/lib/CodeGen/Targets/LoongArch.cpp
- - clang/include/clang/Basic/BuiltinsLoongArch*
-
-clang-format:
- - clang/**/Format/**/*
- - clang/tools/clang-format/**/*
-
-clang-tidy:
- - clang-tools-extra/**/clang-tidy/**/*
- - clang-tools-extra/clang-tidy/**/*
-
-clang:codegen:
- - clang/lib/CodeGen/**/*
- - clang/include/clang/CodeGen/**/*
-
clang:dataflow:
- clang/**/Analysis/**/*
-clang:driver:
- - clang/**/Driver/**/*
-
clang:frontend:
- clang/lib/AST/**/*
- clang/include/clang/AST/**/*
@@ -108,130 +23,43 @@ clang:static analyzer:
- clang/utils/analyzer/**/*
- clang/docs/analyzer/**/*
-clangd:
- - clang-tools-extra/clangd/**/*
-
compiler-rt:
- compiler-rt/**/*
-coroutines:
- - '**/*Coroutine*'
- - '**/*Coroutine*/**/*'
-
flang:
- flang/**/*
-flang:driver:
- - flang/tools/flang-driver/**/*
- - flang/test/Driver/**/*
-
flang:frontend:
- flang/Parser/**/*
- flang/Evaluate/**/*
- flang/Semantics/**/*
-flang:runtime:
- - flang/runtime/**/*
-
HLSL:
- clang/*HLSL*/**/*
- clang/**/*HLSL*
- llvm/**/Frontend/HLSL/**/*
-libc:
- - libc/**/*
- - utils/bazel/llvm-project-overlay/libc/**/*
-
libc++:
- libcxx/**/*
libc++-abi:
- libcxxabi/**/*
-libunwind:
- - libunwind/**/*
-
lld:
- lld/**/*
-lldb:
- - lldb/**/*
-
llvm-lit:
- llvm/utils/lit/**/*
-llvm:SelectionDAGP:
- - llvm/include/llvm/CodeGen/DAGCombine.h
- - llvm/include/llvm/CodeGen/ISDOpcodes.h
- - llvm/include/llvm/CodeGen/SelectionDAG*.h
- - llvm/include/llvm/CodeGen/SDNodeProperties.td
- - llvm/include/llvm/Target/TargetSelectionDAG.td
- - llvm/lib/CodeGen/SelectionDAG/**/*
- - llvm/utils/TableGen/CodeGenDAG*
- - llvm/utils/TableGen/DAGISel*
-
-llvm:globalisel:
- - llvm/**/GlobalISel/**/*
- - llvm/utils/TableGen/GlobalISelEmitter.cpp
- - llvm/utils/TableGen/GICombinerEmitter.cpp
-
-LTO:
- - llvm/**/LTO/**
- - llvm/**/ThinLTO/**
-
mc:
- llvm/**/MC/**
-mlir:
- - mlir/**
-
mlir:afine:
- mlir/**/Affine/**/*
-mlir:bufferization:
- - mlir/**/Bufferization/**/*
-
-mlir:complex:
- - mlir/**/Complex/**/*
-
-mlir:core:
- - mlir/**/AsmParser/**/*
- - mlir/**/Bytecode/**/*
- - mlir/**/Debug/**/*
- - mlir/**/IR/**/*
- - mlir/**/Parser/**/*
- - mlir/**/Pass/**/*
- - mlir/**/Reducer/**/*
- - mlir/**/Support/**/*
- - mlir/**/Transforms/**/*
- - mlir/**/tools/**/*
- - mlir/tools/**/*
-
-mlir:gpu:
- - mlir/**/*GPU*/**/*
-
-mlir:linalg:
- - mlir/**/Linalg/**/*
- - mlir/**/linalg/**/*
-
-mlir:llvm:
- - mlir/**/LLVM/**/*
-
-mlir:memref:
- - mlir/**/MemRef/**/*
-
mlir:python:
- mlir/python/**/*
-mlir:scf:
- - mlir/**/SCF/**/*
-
-mlir:tensor:
- - mlir/**/Tensor/**/*
-
-mlir:tosa:
- - mlir/**/Tosa/**/*
-
mlir:vectorops:
- mlir/**/Vector/**/*
@@ -260,14 +88,641 @@ vectorization:
- llvm/lib/Transforms/Vectorize/**/*
- llvm/include/llvm/Transforms/Vectorize/**/*
+# IMPORTED FROM CODEOWNERS
+LTO:
+ - /llvm/*/LTO/
+ - /llvm/*/Linker/
+ - /llvm/*/ThinLTO/
+ - /llvm/lib/Transforms/*/FunctionImport*
+ - /llvm/tools/gold/
+
+mc:
+ - /llvm/*/MC/
+
+clang:driver:
+ - /clang/*/Driver/
+
+compiler-rt:sanitizer:
+ - /llvm/lib/Transforms/Instrumentation/*Sanitizer*
+ - /compiler-rt/lib/interception/
+ - /compiler-rt/lib/*san*
+ - /compiler-rt/test/*san*
+ - /compiler-rt/lib/fuzzer/
+ - /compiler-rt/test/fuzzer/
+ - /compiler-rt/lib/scudo/
+ - /compiler-rt/test/scudo/
+
xray:
- - llvm/tools/llvm-xray/**
- - compiler-rt/**/xray/**
- - clang/include/clang/Basic/XRay*
- - clang/lib/Basic/XRay*
- - compiler-rt/**/xray/*
- - llvm/include/llvm/XRay/*
- - llvm/lib/XRay/*
- - llvm/tools/llvm-xray/*
- - llvm/unittests/XRay/*
- - compiler-rt/**/xray/*
+ - /llvm/tools/llvm-xray/
+ - /compiler-rt/*/xray/
+ - /clang/include/clang/Basic/XRay*
+ - /clang/lib/Basic/XRay*
+ - /compiler-rt/*/xray/
+ - /llvm/include/llvm/XRay/
+ - /llvm/lib/XRay/
+ - /llvm/tools/llvm-xray/
+ - /llvm/unittests/XRay/
+ - /compiler-rt/*/xray/
+
+clang:codegen:
+ - /clang/lib/CodeGen/**
+ - /clang/include/clang/CodeGen/
+
+mlir:
+ - /mlir/
+
+mlir:core:
+ - /mlir/**/Support/
+ - /mlir/**/Parser/
+ - /mlir/**/IR/
+ - /mlir/**/Bytecode/
+ - /mlir/**/AsmParser/
+ - /mlir/**/Pass/
+ - /mlir/**/tools/
+ - /mlir/**/Reducer/
+ - /mlir/**/Transforms/
+ - /mlir/**/Debug/
+ - /mlir/tools/
+
+mlir:ods:
+ - /mlir/TableGen/
+ - /mlir/tblgen/
+ - /mlir/include/mlir/IR/*.td
+
+mlir:bindings:
+ - /mlir/Bindings/
+
+mlir:gpu:
+ - /mlir/**/*GPU
+
+mlir:amdgpu:
+ - /mlir/**/AMDGPU/
+
+mlir:amx:
+ - /mlir/**/AMX/
+
+mlir:affine:
+ - /mlir/**/Affine/
+
+mlir:arith:
+ - /mlir/**/Arith/
+
+mlir:neon:
+ - /mlir/**/ArmNeon/
+
+mlir:sme:
+ - /mlir/**/ArmSME/
+
+mlir:sve:
+ - /mlir/**/ArmSVE/
+
+mlir:async:
+ - /mlir/**/Async/
+ - /mlir/**/Async/
+
+mlir:bufferization:
+ - /mlir/**/Bufferization/
+
+mlir:complex:
+ - /mlir/**/Complex/
+
+mlir:cf:
+ - /mlir/**/ControlFlow/
+
+mlir:dlti:
+ - /mlir/**/DLTI/
+
+mlir:emitc:
+ - /mlir/**/EmitC/
+
+mlir:func:
+ - /mlir/**/Func/
+
+mlir:irdl:
+ - /mlir/**/IRDL/
+
+mlir:index:
+ - /mlir/**/Index/
+
+mlir:llvm:
+ - /mlir/**/LLVM/
+
+mlir:linalg:
+ - /mlir/**/*linalg
+ - /mlir/**/*Linalg
+
+mlir:mlprogram:
+ - /mlir/**/MLProgram
+
+mlir:math:
+ - /mlir/**/Math/
+
+mlir:memref:
+ - /mlir/**/MemRef/
+
+mlir:nvgpu:
+ - /mlir/**/NVGPU/
+
+mlir:openacc:
+ - /mlir/**/*OpenACC
+
+mlir:openmp:
+ - /mlir/**/*OpenMP
+
+mlir:pdl:
+ - /mlir/**/PDL/
+
+mlir:quant:
+ - /mlir/**/Quant/
+
+mlir:scf:
+ - /mlir/**/SCF/
+
+mlir:spirv:
+ - /mlir/**/SPIRV/
+
+mlir:shape:
+ - /mlir/**/Shape/
+
+mlir:sparse:
+ - /mlir/**/SparseTensor/
+
+mlir:tensor:
+ - /mlir/**/Tensor/
+
+mlir:tosa:
+ - /mlir/**/Tosa/
+
+mlir:ub:
+ - /mlir/**/UB/
+
+mlir:vector:
+ - /mlir/**/*Vector/
+
+mlir:execution-engine:
+ - /mlir/**/ExecutionEngine/
+
+coroutines:
+ - /clang/docs/DebuggingCoroutines.rst
+ - /clang/lib/Sema/SemaCoroutine.cpp
+ - /clang/lib/CodeGen/CGCoroutine.cpp
+ - /clang/test/CodeGenCoroutines/
+ - /llvm/docs/Coroutines.rst
+ - /llvm/include/llvm/Transforms/Coroutines/
+ - /llvm/lib/Transforms/Coroutines/
+ - /llvm/test/Transforms/Coroutines/*
+
+clang:modules:
+ - /clang/docs/StandardCPlusPlusModules.rst
+ - /clang/include/clang/AST/AbstractBasicReader.h
+ - /clang/include/clang/AST/AbstractBasicWriter.h
+ - /clang/include/clang/AST/AbstractTypeReader.h
+ - /clang/include/clang/AST/AbstractTypeWriter.h
+ - /clang/include/clang/AST/PropertiesBase.td
+ - /clang/include/clang/AST/ODRHash.h
+ - /clang/include/clang/AST/TypeProperties.td
+ - /clang/include/clang/Basic/Module.h
+ - /clang/include/clang/Frontend/PrecompiledPreamble.h
+ - /clang/include/clang/Lex/ModuleLoader.h
+ - /clang/include/clang/Lex/ModuleMap.h
+ - /clang/include/clang/Serialization/
+ - /clang/lib/AST/ODRHash.cpp
+ - /clang/lib/AST/StmtProfile.cpp
+ - /clang/lib/Basic/Module.cpp
+ - /clang/lib/Frontend/ModuleDependencyCollector.cpp
+ - /clang/lib/Frontend/PrecompiledPreamble.cpp
+ - /clang/lib/Lex/ModuleMap.cpp
+ - /clang/lib/Sema/SemaModule.cpp
+ - /clang/lib/Serialization/
+ - /clang/test/CXX/module/
+ - /clang/test/Modules/
+ - /clang/unittests/Serialization/*
+
+clang-tidy:
+ - /clang-tools-extra/clang-tidy/
+ - /clang-tools-extra/docs/clang-tidy/
+ - /clang-tools-extra/test/clang-tidy/
+
+tools:llvm-mca:
+ - /llvm/tools/llvm-mca/
+ - /llvm/include/llvm/MCA/
+ - /llvm/lib/MCA/
+
+vectorizers:
+ - /llvm/lib/Transforms/Vectorize/
+ - /llvm/include/llvm/Transforms/Vectorize/
+
+clang:
+ - /clang/
+
+testing-tools:
+ - /llvm/include/llvm/FileCheck/
+ - /llvm/lib/FileCheck/
+ - /llvm/test/FileCheck/
+ - /llvm/unittests/FileCheck/
+ - /llvm/utils/lit/
+ - /llvm/utils/split-file/
+ - /llvm/utils/not/
+ - /llvm/utils/count/
+ - /llvm/utils/FileCheck/
+ - /llvm/docs/CommandGuide/FileCheck.rst
+ - /llvm/docs/CommandGuide/lit.rst
+ - /llvm/docs/TestingGuide.rst
+ - /llvm/test/Other/FileCheck-space.txt
+ - /llvm/utils/UpdateTestChecks/
+ - /llvm/utils/update*_test_checks.py
+
+debuginfo:
+ - /llvm/include/llvm/DebugInfo/
+ - /llvm/lib/DebugInfo/
+ - /llvm/tools/dsymutil/
+ - /llvm/tools/llvm-debuginfo-analyzer/
+ - /llvm/tools/llvm-dwarfdump/
+ - /llvm/tools/llvm-dwarfutil/
+ - /llvm/tools/llvm-dwp/
+ - /llvm/tools/llvm-gsymutil/
+ - /llvm/tools/llvm-pdbutil/
+ - /llvm/tools/llvm-debuginfod/
+ - /llvm/tools/llvm-debuginfod-find/
+ - /llvm/lib/CodeGen/AsmPrinter/
+ - /clang/lib/CodeGen/CGDebugInfo.cpp
+ - /llvm/include/llvm/BinaryFormat/Dwarf.*
+ - /llvm/test/DebugInfo/
+ - /llvm/test/tools/dsymutil/
+ - /llvm/test/tools/llvm-debuginfo-analyzer/
+ - /llvm/test/tools/llvm-debuginfod/
+ - /llvm/test/tools/llvm-debuginfod-find/
+ - /llvm/test/tools/llvm-dwarfdump/
+ - /llvm/test/tools/llvm-dwarfutil/
+ - /llvm/test/tools/llvm-dwp/
+ - /llvm/test/tools/llvm-gsymutil/
+ - /llvm/test/tools/llvm-pdbuti/
+ - /llvm/lib/IR/Debug*.cpp
+ - /llvm/include/llvm/IR/Debug*.h
+
+github:workflow:
+ - /.github/workflows/
+
+flang:driver:
+ - /flang/tools/flang-driver/
+ - /flang/unittests/Frontend/
+ - /flang/lib/FrontendTool/
+ - /flang/lib/Frontend/
+ - /flang/include/flang/Frontend/
+ - /flang/include/flang/FrontendTool/
+ - /flang/test/Driver/
+
+backend:m68k:
+ - /llvm/lib/Target/M68k/
+ - /clang/lib/Basic/Targets/M68k.*
+ - /clang/lib/CodeGen/Targets/M68k.cpp
+ - /llvm/test/CodeGen/M68k/
+ - /llvm/test/MC/Disassembler/M68k/
+ - /llvm/test/MC/M68k/
+
+libc++:
+ - /libcxx/
+ - /runtimes/
+
+libc++abi:
+ - /libcxxabi/
+ - /runtimes/
+
+libunwind:
+ - /libunwind/
+ - /runtimes/
+
+objectyaml:
+ - /llvm/include/llvm/ObjectYAML/
+ - /llvm/lib/ObjectYAML/
+ - /llvm/test/tools/obj2yaml/
+ - /llvm/test/tools/yaml2obj/
+ - /llvm/tools/obj2yaml/
+ - /llvm/tools/yaml2obj/
+
+clang:analysis:
+ - /clang/include/clang/Analysis/
+ - /clang/lib/Analysis/
+
+clang:static analyzer:
+ - /clang/include/clang/StaticAnalyzer/
+ - /clang/lib/StaticAnalyzer/
+ - /clang/tools/scan-build/
+ - /clang/utils/analyzer/
+ - /clang/docs/analyzer/
+
+pgo:
+ - /llvm/lib/Transforms/Instrumentation/CGProfile.cpp
+ - /llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+ - /llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+ - /llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+ - /llvm/lib/Transforms/Instrumentation/PGO*
+ - /llvm/lib/Transforms/Instrumentation/ValueProfile*
+ - /llvm/test/Instrumentation/InstrProfiling/
+ - /llvm/test/Transforms/PGOProfile/
+ - /compiler-rt/lib/profile/
+ - /compiler-rt/lib/memprof/
+ - /compiler-rt/test/profile/
+ - /compiler-rt/test/memprof/
+ - /llvm/tools/llvm-profdata/
+ - /llvm/tools/llvm-profgen/
+ - /llvm/test/tools/llvm-profdata/
+ - /llvm/test/tools/llvm-profgen/
+ - /llvm/unittests/ProfileData/*
+
+openacc:
+ - /flang/**/OpenACC/
+ - /flang/include/flang/Lower/OpenACC.h
+ - /flang/docs/OpenACC.md
+ - /flang/lib/Parser/openacc-parsers.cpp
+ - /flang/lib/Lower/OpenACC.cpp
+ - /llvm/**/Frontend/OpenACC/
+ - /llvm/unittests/Frontend/OpenACCTest.cpp
+ - /mlir/test/Target/LLVMIR/openacc-llvm.mlir
+ - /mlir/**/*OpenACC/
+
+flang:runtime:
+ - /flang/runtime/
+
+flang:parser:
+ - /flang/**/Parser/
+
+flang:semantics:
+ - /flang/**/Evaluate/
+ - /flang/**/Semantics/
+
+flang:fir-hlfir:
+ - /flang/**/Lower/
+ - /flang/**/Optimizer/
+
+flang:codegen:
+ - flang/**/CodeGen/
+
+llvm:globalisel:
+ - /llvm/**/GlobalISel/
+ - /llvm/utils/TableGen/GlobalISel*
+
+function-specialization:
+ - /llvm/include/llvm/Transforms/Utils/SCCPSolver.h
+ - /llvm/lib/Transforms/Utils/SCCPSolver.cpp
+ - /llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+ - /llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+ - /llvm/test/Transforms/FunctionSpecialization/*
+
+libc:
+ - libc/**
+ - utils/bazel/llvm-project-overlay/libc/**
+
+clang-format:
+ - /clang/**/Format/
+ - /clang/tools/clang-format/
+
+flang:openmp:
+ - /flang/test/**/OpenMP/
+ - /flang/lib/Lower/OpenMP.cpp
+ - /flang/lib/Semantics/resolve-directives.cpp
+ - /flang/lib/Semantics/check-omp-structure.cpp
+ - /flang/lib/Optimizer/Transforms/OMP*
+ - /flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
+ - /flang/test/Lower/OpenMP/
+ - /flang/test/Transforms/omp*
+ - /mlir/**/*OpenMP*
+ - /mlir/test/Target/LLVMIR/openmp*
+ - /llvm/lib/Frontend/OpenMP/
+ - /llvm/include/llvm/Frontend/OpenMP/
+ - /llvm/unittests/Frontend/OpenMP*
+
+llvm:ir:
+ - /llvm/lib/IR/
+ - /llvm/include/llvm/IR/
+ - /llvm/docs/LangRef.rst
+
+llvm:analysis:
+ - /llvm/lib/Analysis/
+ - /llvm/include/llvm/Analysis/
+
+llvm:transforms:
+ - /llvm/lib/Transforms/
+ - /llvm/include/llvm/Transforms/
+
+clangd:
+ - /clang-tools-extra/clangd/
+
+hlsl:
+ - /clang/test/ParserHLSL/
+ - /clang/test/SemaHLSL/
+ - /clang/test/AST/HLSL/
+ - /clang/test/CodeGenHLSL/
+ - /clang/cmake/caches/HLSL.cmake
+ - /clang/include/clang/Basic/HLSL*.h
+ - /clang/include/clang/Sema/HLSL*.h
+ - /clang/docs/HLSL/
+ - /clang/lib/Driver/ToolChains/HLSL*
+ - /clang/lib/Parse/ParseHLSL.cpp
+ - /clang/lib/Sema/HLSLExternalSemaSource.cpp
+ - /clang/lib/Sema/SemaHLSL.cpp
+ - /clang/lib/CodeGen/CGHLSLRuntime.*
+ - /llvm/include/llvm/Frontend/HLSL/
+ - /llvm/lib/Frontend/HLSL/
+
+llvm:SelectionDAG:
+ - /llvm/include/llvm/CodeGen/SelectionDAG*.h
+ - /llvm/include/llvm/CodeGen/SDNodeProperties.td
+ - /llvm/include/llvm/Target/TargetSelectionDAG.td
+ - /llvm/lib/CodeGen/SelectionDAG/
+ - /llvm/utils/TableGen/CodeGenDAG*
+ - /llvm/utils/TableGen/DAGISel*
+ - /llvm/include/llvm/CodeGen/DAGCombine.h
+ - /llvm/include/llvm/CodeGen/ISDOpcodes.h
+
+backend:DirectX:
+ - /llvm/lib/Target/DirectX/
+ - /llvm/test/CodeGen/DirectX/
+ - /llvm/tools/dxil-dis
+ - /llvm/test/tools/dxil-dis
+ - /clang/lib/Basic/Targets/DirectX*
+ - /llvm/include/llvm/IR/IntrinsicsDirectX.td
+
+mlgo:
+ - /llvm/lib/Analysis/ML*
+ - /llvm/include/llvm/Analysis/ML*
+ - /llvm/lib/Analysis/*Runner.cpp
+ - /llvm/include/llvm/Analysis/*Runner.h
+ - /llvm/unittests/Analysis/ML*
+ - /llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
+ - /llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h
+ - /llvm/test/Analysis/FunctionPropertiesAnalysis/*
+ - /llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp
+ - /llvm/test/Transforms/inline/ML/
+ - /llvm/lib/CodeGen/ML*
+ - /llvm/unittests/CodeGen/ML*
+ - /llvm/test/CodeGen/MLRegAlloc/
+
+tools:llvm-exegesis:
+ - /llvm/tools/llvm-exegesis/
+ - /llvm/test/tools/llvm-exegesis/
+ - /llvm/unittests/tools/llvm-exegesis/
+
+platform:windows:
+ - /lld/COFF/
+ - /clang/lib/Driver/MSVC.cpp
+ - /clang/lib/Driver/MinGW.cpp
+ - /llvm/lib/DebugInfo/CodeView/
+ - /llvm/lib/DebugInfo/PDB/
+ - /llvm/lib/WindowsDriver/
+ - /llvm/lib/Support/Windows/
+ - /llvm/lib/BinaryFormat/COFF.cpp
+
+llvm:regalloc:
+ - /llvm/**/CodeGen/CalcSpillWeights*
+ - /llvm/**/CodeGen/InlineSpiller*
+ - /llvm/**/CodeGen/InterferenceCache*
+ - /llvm/**/CodeGen/LiveInterval*
+ - /llvm/**/CodeGen/LiveRange*
+ - /llvm/**/CodeGen/LiveReg*
+ - /llvm/**/CodeGen/LiveVariables*
+ - /llvm/**/CodeGen/MachineCopyPropagation*
+ - /llvm/**/CodeGen/PHIElimination*
+ - /llvm/**/CodeGen/ProcessImplicitDefs.cpp
+ - /llvm/**/CodeGen/Register*
+ - /llvm/**/CodeGen/RegUsage*
+ - /llvm/**/CodeGen/RenameIndependentSubregs.cpp
+ - /llvm/**/CodeGen/SlotIndexes.h
+ - /llvm/**/CodeGen/SpillPlacement*
+ - /llvm/**/CodeGen/SplitKit*
+ - /llvm/**/CodeGen/VirtRegMap.h
+ - /llvm/include/PBQP/
+ - /llvm/include/PBQPRAConstraint.h
+ - /llvm/include/llvm/CodeGen/Spiller.h
+ - /llvm/**/*RegAlloc
+
+mlir:presburger:
+ - /mlir/**/*Presburger
+
+lldb:
+ - /lldb/**
+
+backend:AMDGPU:
+ - '**/*amdgpu*'
+ - '**/*AMDGPU*'
+
+backend:RISC-V:
+ - /clang/**/*riscv*
+ - /clang/**/*RISCV*
+ - /llvm/**/*riscv*
+ - /llvm/**/*RISCV*
+
+lld:coff:
+ - /lld/**/COFF/
+ - /lld/Common/
+
+lld:elf:
+ - /lld/**/ELF/
+ - /lld/Common/
+
+lld:macho:
+ - /lld/**/MachO/
+ - /lld/Common/
+
+lld:wasm:
+ - /lld/**/wasm/
+ - /lld/Common/
+
+backend:ARM:
+ - /llvm/include/llvm/IR/IntrinsicsARM.td
+ - /llvm/test/MC/ARM/
+ - /llvm/lib/Target/ARM/
+ - /llvm/test/CodeGen/ARM/
+ - /clang/lib/Basic/Targets/ARM*
+ - /clang/lib/Driver/ToolChains/Arch/ARM.*
+ - /clang/lib/CodeGen/Targets/ARM.cpp
+ - /clang/include/clang/Basic/BuiltinsARM*
+ - /llvm/test/MC/DisasemblerARM/
+
+backend:AArch64:
+ - /llvm/include/llvm/IR/IntrinsicsAArch64.td
+ - /llvm/test/MC/AArch64/
+ - /llvm/lib/Target/AArch64/
+ - /llvm/test/CodeGen/AArch64/
+ - /clang/lib/Basic/Targets/AArch64*
+ - /clang/lib/Driver/ToolChains/Arch/AArch64.*
+ - /clang/lib/CodeGen/Targets/AArch64.cpp
+ - /clang/include/clang/Basic/BuiltinsAArch64*
+ - /llvm/test/MC/Disassembler/AArch64/
+
+backend:loongarch:
+ - /llvm/include/llvm/IR/IntrinsicsLoongArch.td
+ - /llvm/test/MC/LoongArch/
+ - /llvm/lib/Target/LoongArch/
+ - /llvm/test/CodeGen/LoongArch/
+ - /clang/lib/Basic/Targets/LoongArch*
+ - /clang/lib/Driver/ToolChains/Arch/LoongArch.*
+ - /clang/lib/CodeGen/Targets/LoongArch.cpp
+ - /clang/include/clang/Basic/BuiltinsLoongArch*
+
+backend:MSP430:
+ - /llvm/include/llvm/IR/IntrinsicsMSP430.td
+ - /llvm/test/MC/MSP430/
+ - /llvm/lib/Target/MSP430/
+ - /llvm/test/CodeGen/MSP430/
+ - /clang/lib/Basic/Targets/MSP430*
+ - /clang/lib/Driver/ToolChains/Arch/MSP430.*
+ - /clang/lib/CodeGen/Targets/MSP430.cpp
+ - /clang/include/clang/Basic/BuiltinsMSP430*
+ - /llvm/test/MC/Disassembler/MSP430/
+
+backend:Sparc:
+ - /llvm/include/llvm/IR/IntrinsicsSparc.td
+ - /llvm/test/MC/Sparc/
+ - /llvm/lib/Target/Sparc/
+ - /llvm/test/CodeGen/Sparc/
+ - /clang/lib/Basic/Targets/Sparc*
+ - /clang/lib/Driver/ToolChains/Arch/Sparc.*
+ - /clang/lib/CodeGen/Targets/Sparc.cpp
+ - /clang/include/clang/Basic/BuiltinsSparc*
+ - /llvm/test/MC/Disassembler/Sparc/
+
+backend:WebAssembly:
+ - /llvm/lib/Target/WebAssembly/
+ - /llvm/test/CodeGen/WebAssembly/
+ - /clang/lib/Basic/Targets/WebAssembly*
+ - /clang/include/clang/Basic/BuiltinsWebAssembly.def
+ - /clang/include/clang/Basic/WebAssemblyReferenceTypes.def
+ - /clang/lib/CodeGen/Targets/WebAssembly*
+ - /llvm/include/llvm/IR/IntinsicsWebAssembly.td
+ - /llvm/include/llvm/Object/Wasm*
+ - /llvm/lib/CodeGen/AsmPrinter/Wasm*
+ - /llvm/lib/CodeGen/Wasm*
+ - /llvm/lib/MC/MCParser/Wasm*
+ - /llvm/lib/MC/Wasm*
+ - /llvm/lib/ObjCopy/wasm/
+ - /llvm/lib/Object/Wasm*
+ - /clang/lib/Driver/Toolchains/WebAssembly*
+ - /clang/lib/Headers/wasm_simd128.h
+ - /clang/test/CodeGen/WebAssembly/
+ - /clang/test/SemaCXX/*wasm*
+ - /clang/test/Sema/*wasm*
+ - /llvm/include/llvm/BinaryFormat/Wasm.h
+ - /llvm/unittests/Target/WebAssembly/
+ - /llvm/test/DebugInfo/WebAssembly/
+ - /llvm/test/MC/WebAssembly/
+
+backend:X86:
+ - /llvm/include/llvm/IR/IntrinsicsX86.td
+ - /llvm/lib/Target/X86/
+ - /llvm/test/CodeGen/X86/
+ - /llvm/test/MC/X86/
+ - /llvm/test/MC/Disassembler/X86/
+ - /llvm/test/Analysis/CostModel/X86/
+ - /llvm/test/tools/llvm-mca/X86/
+ - /clang/lib/Basic/Targets/X86/
+ - /clang/lib/Driver/ToolChains/Arch/X86.*
+ - /clang/lib/CodeGen/Targets/X86.*
+ - /clang/lib/Headers/
+ - /clang/test/CodeGen/X86/
+ - /clang/include/clang/Basic/BuiltinsX86*
+ - /llvm/include/llvm/Support/X86DisassemblerDecoderCommon.h
+ - /llvm/include/llvm/TargetParser/X86*
+ - /llvm/lib/TargetParser/X86*
+ - /llvm/utils/TableGen/X86*
+
diff --git a/.github/workflows/pr-subscriber.yml b/.github/workflows/pr-subscriber.yml
index a4c045a05635b2b..af40f836811d6e8 100644
--- a/.github/workflows/pr-subscriber.yml
+++ b/.github/workflows/pr-subscriber.yml
@@ -3,7 +3,7 @@ name: PR Subscriber
on:
pull_request:
types:
- - opened
+ - labeled
permissions:
contents: read
@@ -20,8 +20,12 @@ jobs:
pip install -r requirements.txt
- name: Update watchers
+ # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
+ env:
+ LABEL_NAME: ${{ github.event.label.name }}
run: |
./github-automation.py \
--token '${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}' \
pr-subscriber \
--issue-number '${{ github.event.pull_request.number }}'
+ --label-name "$LABEL_NAME"
diff --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index 30e1a4c49a951a5..ac5fe925f46dad7 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -67,39 +67,26 @@ def run(self) -> bool:
class PRSubscriber:
+ @property
+ def team_name(self) -> str:
+ return self._team_name
- class PRTeam:
- def __init__(self, slug: str, description: str):
- self.slug = slug
- self.globs = [x.strip() for x in description.split(",")]
-
- def __init__(self, token: str, repo: str, pr_number: int):
+ def __init__(self, token: str, repo: str, pr_number: int, label_name : str):
self.repo = github.Github(token).get_repo(repo)
self.org = github.Github(token).get_organization(self.repo.organization.login)
self.pr = self.repo.get_issue(pr_number).as_pull_request()
- self.teams = []
- for team in self.org.get_teams():
- if not team.name.startswith("pr-subscribers-"):
- continue
- self.teams.append(PRSubscriber.PRTeam(team.slug, team.description))
+ self._team_name = "pr-subscribers-{}".format(label_name).lower()
def run(self) -> bool:
- mentions = []
- for c in self.pr.get_commits():
- for f in c.files:
- print(f.filename)
- for t in self.teams:
- for g in t.globs:
- if len(fnmatch.filter([f.filename for f in c.files], g)):
- print('Matches {} for {}'.format(g, t.slug))
- mentions.append(t.slug)
- break
-
- if not len(mentions):
- return False
-
- comment = "\n".join(['@llvm/{}'.format(m) for m in mentions])
- self.pr.as_issue().create_comment(comment)
+ for team in self.org.get_teams():
+ if self.team_name != team.name.lower():
+ continue
+ try:
+ patch = requests.get(self.pr.diff_url).text
+ except:
+ patch = ""
+ comment = "@llvm/{}".format(team.slug) + "\n\n<details><summary>Changes</summary><pre>\n" + patch + "\n</pre></details>"
+ self.pr.as_issue().create_comment(comment)
return True
@@ -545,6 +532,7 @@ def execute_command(self) -> bool:
issue_subscriber_parser.add_argument("--issue-number", type=int, required=True)
pr_subscriber_parser = subparsers.add_parser("pr-subscriber")
+pr_subscriber_parser.add_argument("--label-name", type=str, required=True)
pr_subscriber_parser.add_argument("--issue-number", type=int, required=True)
release_workflow_parser = subparsers.add_parser("release-workflow")
@@ -594,7 +582,7 @@ def execute_command(self) -> bool:
issue_subscriber.run()
elif args.command == "pr-subscriber":
pr_subscriber = PRSubscriber(
- args.token, args.repo, args.issue_number
+ args.token, args.repo, args.issue_number, args.label_name
)
pr_subscriber.run()
elif args.command == "release-workflow":
More information about the llvm-commits
mailing list