From 8dc12df71d21ac2b502e2bb89296f465d2088ca5 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Wed, 14 Dec 2022 14:27:30 -0800 Subject: [PATCH] Automate labeling of explorer and toolchain PRs (#2470) Pixep has been doing this by hand, so offering up some automation. This is derivative of other workflows for [path-filter](https://github.com/carbon-language/carbon-lang/blob/trunk/.github/workflows/assign_prs.yaml) and [using gh for labels](https://github.com/carbon-language/carbon-lang/blob/trunk/.github/workflows/proposal_labeled.yaml). It felt best to stick it in its own workflow rather than merging with assign_prs.yaml, just to make the boundary clearer (I believe the separate workflow is cheap). --- .github/workflows/label_prs.yaml | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/label_prs.yaml diff --git a/.github/workflows/label_prs.yaml b/.github/workflows/label_prs.yaml new file mode 100644 index 000000000000..1fe0f408b03e --- /dev/null +++ b/.github/workflows/label_prs.yaml @@ -0,0 +1,37 @@ +# Part of the Carbon Language project, under the Apache License v2.0 with LLVM +# Exceptions. See /LICENSE for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +name: 'Auto label PRs' +on: + pull_request_target: + types: [opened, ready_for_review] + +jobs: + assign_reviewer: + runs-on: ubuntu-latest + steps: + - id: filter + uses: dorny/paths-filter@v2 + with: + filters: | + explorer: + - 'explorer/**' + toolchain: + - 'toolchain/**' + + - id: explorer + if: steps.filter.outputs.explorer == 'true' + run: | + gh pr edit "${PR}" --add-label "explorer" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ github.event.pull_request.html_url }} + + - id: assign-toolchain + if: steps.filter.outputs.toolchain == 'true' + run: | + gh pr edit "${PR}" --add-label "toolchain" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR: ${{ github.event.pull_request.html_url }}