From 8b78a85276994e64cb1f7d57d12d4b47701616cc Mon Sep 17 00:00:00 2001 From: Jon Meow <46229924+jonmeow@users.noreply.github.com> Date: Thu, 22 Apr 2021 14:43:38 -0700 Subject: [PATCH] Action to label proposals based on project column (#484) Note there's a roughly minute delay due to action latency. --- .github/workflows/update_project_card.yaml | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/update_project_card.yaml diff --git a/.github/workflows/update_project_card.yaml b/.github/workflows/update_project_card.yaml new file mode 100644 index 000000000000..7b38dbcf5cc4 --- /dev/null +++ b/.github/workflows/update_project_card.yaml @@ -0,0 +1,67 @@ +# 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: Update label from project card + +on: + project_card: + types: [moved] + +# To get project IDs: https://docs.github.com/en/graphql/overview/explorer +# { +# repository(name: "carbon-lang", owner: "carbon-language") { +# projects(first: 10) { +# nodes { +# name +# databaseId +# } +# } +# } +# } + +jobs: + update-project-card-label: + runs-on: ubuntu-latest + steps: + - name: Label proposals + uses: Matticusau/projectcard-autolabel@v1.0.0 + # Only run on proposals. + if: + github.event.project_card.project_url == + 'https://api.github.com/projects/11995172' + with: + # Label casing must match precisely for removal to work. + autolabel-config: > + [ + {"column": "draft", + "add_labels": ["proposal"], + "remove_labels": ["RFC", + "decision: accepted", + "decision: deferred", + "decision: declined"]}, + {"column": "RFC", + "add_labels": ["proposal", "RFC"], + "remove_labels": ["decision: accepted", + "decision: deferred", + "decision: declined"]}, + {"column": "Accepted", + "add_labels": ["proposal", "decision: accepted"], + "remove_labels": ["RFC", + "decision: deferred", + "decision: declined"]}, + {"column": "Deferred", + "add_labels": ["proposal", "decision: deferred"], + "remove_labels": ["RFC", + "decision: accepted", + "decision: declined"]}, + {"column": "Declined", + "add_labels": ["proposal", "decision: declined"], + "remove_labels": ["RFC", + "decision: accepted", + "decision: deferred"]}] + # I tried making the project filter work, but when I tried to put the + # project into the filter the action stopped matching, so I used the + # `if` instead. + projectfilter-config: '{"include": ["*"]}' + repo-token: ${{ secrets.GITHUB_TOKEN }}