Files
zed/.github/workflows/community_pr_board.yml
T
Lena 4c90ed88c3 Add more fields to the community PR board (#66617)
- Last push: the head commit's committer date, which moves with rebases
and merges from `main`.
- Merge conflicts
- Opened with no self-review: that's the `no self-review` label.

The Upvotes field now also counts comments and reviews too (and still
deduplicates per person).

The daily refresh had hit its 15-minute timeout many times so it now
fetches board items in batches of 10 (one at a time if a batch fails),
writes only values that changed, asks GitHub again for mergeability it
hasn't computed yet, and fails the run if any PR failed instead of
exiting successfully.

In `github_helpers.py`, `set_github_project_field` now handles number,
date and text fields, clears a field for `None` and can skip missing
fields. `is_staff_member` reads the staff team once per run. Requests
share one HTTP session. Rate-limited requests are retried, writes
included, as are project field writes that hit transient errors.

The refresh workflow is renamed to "Community PR Board Signals Refresh"
(also in the Slack failure notifier) for moar consistency, and it gets
members:read for the staff list.

## Testing

Ran from my machine and it worked (after two fix-ups)

Release Notes:

- N/A
2026-11-06 14:32:34 +00:00

86 lines
3.1 KiB
YAML

# Community PR Board — route labeled community PRs to a GitHub Project board
#
# When an area/platform label is added to or already present when reopening a
# community PR (not staff, not bot), the PR is added to the project board with a
# Track field set to the matching review area group, and its signal fields are
# recomputed. Status transitions for assignment, re-request, and comment events
# are handled here. Review-based status changes (approved → "In Progress (us)",
# changes requested → "In Progress (author)") are handled by built-in board
# automations.
#
# See script/community-pr-track-mapping.json for the label→track mapping.
name: Community PR Board
on:
# zizmor: ignore[dangerous-triggers]
# Fork PRs must be supported, but this workflow only reads event metadata and
# checks out scripts from the trusted default branch; it never executes PR code.
pull_request_target:
types: [labeled, unlabeled, reopened, assigned, review_requested, edited]
issue_comment:
types: [created]
workflow_dispatch:
inputs:
pr_number:
description: "PR number to process (re-resolves Track and recomputes signals)"
required: true
type: number
permissions:
contents: read
concurrency:
group: community-pr-board-${{ github.event.pull_request.number || github.event.issue.number || inputs.pr_number }}
cancel-in-progress: false
jobs:
route-pr:
if: >-
github.repository == 'zed-industries/zed' &&
(github.event_name != 'issue_comment' ||
(github.event.issue.pull_request &&
github.event.comment.user.login == github.event.issue.user.login)) &&
!contains(toJSON(github.event.pull_request.labels.*.name), 'staff') &&
!contains(toJSON(github.event.pull_request.labels.*.name), 'bot')
runs-on: namespace-profile-2x4-ubuntu-2404
timeout-minutes: 5
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
with:
app-id: ${{ secrets.ZED_COMMUNITY_BOT_APP_ID }}
private-key: ${{ secrets.ZED_COMMUNITY_BOT_PRIVATE_KEY }}
owner: zed-industries
repositories: zed
permission-issues: read
permission-members: read
permission-organization-projects: write
permission-pull-requests: read
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
sparse-checkout: |
script/github-community-pr-board.py
script/github_helpers.py
script/community-pr-track-mapping.json
sparse-checkout-cone-mode: false
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Install dependencies
run: pip install requests
- name: Route PR to board
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
PROJECT_NUMBER: "85"
MANUAL_PR_NUMBER: ${{ inputs.pr_number }}
run: python script/github-community-pr-board.py