Просмотр исходного кода

Switch proposal process from projects to labels (#1981)

This is being done because Projects v1 requires repo write access, a serious limitation for letting people use it. Projects v2 isn't a great option because it lacks event support. Labels are pretty stable in GitHub, so this switches to that.

Note this assumes we're fine renaming "decision: accepted" -> "proposal accepted", etc. There are two reasons for this:

1) To make it clear that this is a proposal-specific label, versus something like an issue for leads label.
2) Removing the colon because it was causing trouble with yaml syntax.

This also adds the "proposal draft" label, mainly to complete the taxonomy.

I was considering whether this should be a proposal itself, but it feels like maybe it's not necessary because it's a fairly low-key infrastructure change, and I'm not sure how much people were relying on the project board anyways.

I tested this in a personal repo, basically just poking at https://github.com/jonmeow/test/pull/2
Jon Ross-Perkins 3 лет назад
Родитель
Сommit
9b3f80c6d6

+ 94 - 0
.github/workflows/proposal_labeled.yaml

@@ -0,0 +1,94 @@
+# 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
+
+# Applies mutual exclusivity between states labels:
+# - proposal draft
+# - proposal rfc
+# - proposal accepted
+# - proposal declined
+# - proposal deferred
+#
+# The "proposal" label is always applied in order to make searching for all
+# proposals (regardless of state) easy, although it will typically already be
+# present.
+
+name: Proposal labeled
+on:
+  pull_request:
+    types:
+      - labeled
+
+jobs:
+  proposal_labeled:
+    runs-on: ubuntu-latest
+    steps:
+      - name: draft
+        if: |
+          github.event.label.name == 'proposal draft'
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal rfc" \
+            --remove-label "proposal accepted" \
+            --remove-label "proposal declined" \
+            --remove-label "proposal deferred" \
+            --add-label "proposal"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}
+
+      - name: rfc
+        if: |
+          github.event.label.name == 'proposal rfc'
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal draft" \
+            --remove-label "proposal accepted" \
+            --remove-label "proposal declined" \
+            --remove-label "proposal deferred" \
+            --add-label "proposal"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}
+
+      - name: accepted
+        if: |
+          github.event.label.name == 'proposal accepted'
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal draft" \
+            --remove-label "proposal rfc" \
+            --remove-label "proposal declined" \
+            --remove-label "proposal deferred" \
+            --add-label "proposal"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}
+
+      - name: declined
+        if: |
+          github.event.label.name == 'proposal declined'
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal draft" \
+            --remove-label "proposal rfc" \
+            --remove-label "proposal accepted" \
+            --remove-label "proposal deferred" \
+            --add-label "proposal"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}
+
+      - name: deferred
+        if: |
+          github.event.label.name == 'proposal deferred'
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal draft" \
+            --remove-label "proposal rfc" \
+            --remove-label "proposal accepted" \
+            --remove-label "proposal declined" \
+            --add-label "proposal"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}

+ 28 - 0
.github/workflows/proposal_ready.yaml

@@ -0,0 +1,28 @@
+# 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
+
+# Applies the "proposal rfc" label when a proposal is marked ready for review.
+
+name: Proposal ready for review
+on:
+  pull_request:
+    types:
+      - ready_for_review
+
+jobs:
+  proposal_ready:
+    if: contains(github.event.pull_request.labels.*.name, 'proposal')
+    runs-on: ubuntu-latest
+    steps:
+      - name: rfc
+        run: |
+          gh pr edit "${PR}" \
+            --remove-label "proposal draft" \
+            --remove-label "proposal accepted" \
+            --remove-label "proposal declined" \
+            --remove-label "proposal deferred" \
+            --add-label "proposal rfc"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PR: ${{ github.event.pull_request.html_url }}

+ 0 - 67
.github/workflows/update_project_card.yaml

@@ -1,67 +0,0 @@
-# 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 }}

+ 1 - 1
CONTRIBUTING.md

@@ -64,7 +64,7 @@ If you're looking for a quick way to contribute, commenting on proposals is a
 way to provide proposal authors with a breadth of feedback. The
 ["leads questions" label](https://github.com/carbon-language/carbon-lang/issues?q=is%3Aissue+is%3Aopen+label%3A%22leads+question%22)
 has questions the community is looking for a decision on. The
-[list of open proposals](https://github.com/carbon-language/carbon-lang/issues?q=is%3Aopen+label%3Aproposal+draft%3Afalse)
+[list of open proposals](https://github.com/carbon-language/carbon-lang/pulls?q=is%3Apr+is%3Aopen+label%3A%22proposal+rfc%22)
 will have more mature proposals that are nearing a decision. For more about the
 difference, see the [evolution process](docs/project/evolution.md).
 

+ 11 - 19
docs/project/evolution.md

@@ -65,16 +65,14 @@ language are well explained, justified, and reviewed by the community.
     [the template](/proposals/scripts/template.md).
 
 -   Proposal PRs start in draft mode. When proposal PRs are ready, click on
-    ["Ready for review"](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review),
-    and change the
-    [Proposals project column](https://github.com/carbon-language/carbon-lang/projects/1)
-    to "RFC". The project column should be available as a dropdown under
-    "Projects" on the PR.
+    ["Ready for review"](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review).
+    This will:
 
-    -   This will result in a Carbon lead being assigned to review the PR.
+    -   Route the proposal to a Carbon lead for review.
 
-    -   This also signifies an RFC (request for comment) from the entire
-        community.
+    -   Send the proposal as a broad RFC to the community.
+
+    -   Add the "proposal rfc" label for tracking.
 
 -   Contributors are encouraged to react with a _thumbs-up_ to proposal PRs if
     they are generally interested and supportive of the high-level direction
@@ -139,19 +137,13 @@ issues for longer discussion:
 
 -   When ready, click on
     ["Ready for review"](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review)
-    in GitHub, and change the
-    [Proposals project column](https://github.com/carbon-language/carbon-lang/projects/1)
-    to "RFC". The project column should be available as a dropdown under
-    "Projects" on the PR.
+    in GitHub. This will:
 
-    -   This will result in the PR being assigned to an individual for review.
+    -   Route the proposal to a Carbon lead for review.
 
-    -   This will also send the proposal as a broad RFC to the community.
+    -   Send the proposal as a broad RFC to the community.
 
-    -   While setting the "RFC" project column will also add the "RFC" label,
-        the reverse is not true. Unfortunately, this is currently a limit of
-        GitHub automation. Similarly, Adding the "RFC" project column currently
-        does not set "Ready for review".
+    -   Add the "proposal rfc" label for tracking.
 
 -   Address comments where you can and they make sense.
 
@@ -181,7 +173,7 @@ issues for longer discussion:
 #### Community
 
 -   We use the
-    [Proposals dashboard](https://github.com/carbon-language/carbon-lang/projects/1)
+    ["proposal rfc" label](https://github.com/carbon-language/carbon-lang/pulls?q=is%3Apr+is%3Aopen+label%3A%22proposal+rfc%22)
     to track proposals that are in RFC.
 
     -   Anyone that is interested can participate once a proposal is ready for

+ 2 - 3
proposals/scripts/new_proposal.py

@@ -196,9 +196,8 @@ def main() -> None:
             "--draft",
             "--label",
             "proposal",
-            # TODO: https://github.com/carbon-language/carbon-lang/issues/1898
-            # "--project",
-            # "Proposals",
+            "--label",
+            "proposal draft",
             "--reviewer",
             "carbon-language/carbon-leads",
             "--repo",

+ 1 - 1
proposals/scripts/template.md

@@ -28,7 +28,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
 1. Copy this template to `new.md`, and create a commit.
 2. Create a GitHub pull request, to get a pull request number.
-    - Add the `proposal` and `WIP` labels to the pull request.
+    - Add the `proposal draft` label to the pull request.
 3. Rename `new.md` to `/proposals/p####.md`, where `####` should be the pull
    request number.
 4. Update the title of the proposal (the `TODO` on line 1).