This is an automated email from the ASF dual-hosted git repository. rusackas pushed a commit to branch ci/wiki-driven-author-labeler in repository https://gitbox.apache.org/repos/asf/superset.git
commit 82c0a4e528cb1115c1e89117ce753d8936c8d3eb Author: Evan Rusackas <[email protected]> AuthorDate: Tue Nov 17 10:27:00 2026 -0800 ci(labeler): read author label rosters from the wiki The utsc2026 labeler read its roster from .github/utsc2026-students.yml, so every roster change needed a PR. Rename it to a general author labeler that reads label-to-handle rosters from the Label-Rosters wiki page. Labels the wiki may assign stay on an allowlist in the workflow, since wiki edits are unreviewed and some labels drive other workflows. Co-Authored-By: Evan Rusackas <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]> --- .github/utsc2026-students.yml | 63 ------------------- .github/workflows/author-labeler.yml | 87 ++++++++++++++++++++++++++ .github/workflows/utsc2026-labeler.yml | 57 ----------------- docs/developer_docs/contributing/guidelines.md | 9 +++ 4 files changed, 96 insertions(+), 120 deletions(-) diff --git a/.github/utsc2026-students.yml b/.github/utsc2026-students.yml deleted file mode 100644 index a760dba40a8..00000000000 --- a/.github/utsc2026-students.yml +++ /dev/null @@ -1,63 +0,0 @@ -# GitHub handles of UTSC 2026 course students. Any PR or issue opened by one -# of these users is automatically labeled `utsc2026` (see -# .github/workflows/utsc2026-labeler.yml). One handle per line, as a YAML -# list item (`- handle`); `#` starts a comment. -- JusByte -- 7AbdUrRehman7 -- jonathan-imanu -- ara1143 -- MealadE -- ali-rajan -- NabilAldihni -- amnakhairi0 -- alizaasifb -- CodingRookieA -- moizm05 -- jchong9 -- EkVid -- KristiDodaj -- Kushal-D-Patel -- Haseeb702 -- Jain-m3392 -- alankritverma01 -- Adrit-3001 -- IshanAmin1 -- rhodwell -- amandajzhu -- mbilal29 -- HariBala246 -- mallisho -- MegumiKat -- orion222 -- ashyng -- MatthewSnelgrove -- auricz -- milen-t050 -- JosephSun2003 -- JerryHe05 -- dujanah -- MichaelWK04 -- BobbyAdiSalim -- ansh-patel2005 -- KobeChui -- DarthJarJarJar -- HBenipal -- yoloanda -- CherylZ4 -- RohithS05 -- ZayLinAung -- devCodesApps -- IsaiahH2004 -- dauiysuns -- AashirM2004 -- Madan015 -- teddio496 -- lilyxm -- anish422 -- neloduka-sobe -- danishmohammed -- danielstevanus88 -- adeebnawshad -- zuhair-mzk -- LucasP4321 -- eliu0412 diff --git a/.github/workflows/author-labeler.yml b/.github/workflows/author-labeler.yml new file mode 100644 index 00000000000..0f59040a06f --- /dev/null +++ b/.github/workflows/author-labeler.yml @@ -0,0 +1,87 @@ +name: "Author Labeler" + +on: # zizmor: ignore[dangerous-triggers] - needs pull_request_target for a + # writable token on fork PRs; the script only reads the opaque author + # login/number fields below, never PR-controlled free text (title, body, + # branch), and nothing is interpolated into a shell `run:` + pull_request_target: + branches: [master] + types: [opened] + issues: + types: [opened] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + label: + name: Label + permissions: + contents: read + issues: write # to add a roster label to a matching issue + pull-requests: write # to add a roster label to a matching PR + runs-on: ubuntu-slim + steps: + - name: Label if the author is on a wiki roster + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + // Rosters live on the wiki so committers can edit them without a + // PR: https://github.com/apache/superset/wiki/Label-Rosters + // Each `## heading` on that page is a label; each list item under + // it is a GitHub handle. + const ROSTER_PAGE = 'Label-Rosters'; + + // The wiki can only assign labels named here. Wiki edits are not + // reviewed, and some labels drive other workflows (`hold`, + // showtime), so adding a label to this list takes a PR while + // adding handles to a roster does not. + const ALLOWED_LABELS = ['utsc2026']; + + const { owner, repo } = context.repo; + const url = `https://raw.githubusercontent.com/wiki/${owner}/${repo}/${ROSTER_PAGE}.md`; + const response = await fetch(url); + if (!response.ok) { + core.warning(`Could not read ${url} (HTTP ${response.status}); no roster labels applied.`); + return; + } + + const rosters = new Map(); + let label = null; + for (const line of (await response.text()).split('\n')) { + const heading = line.match(/^##\s+`?([^`]+?)`?\s*$/); + if (heading) { + label = heading[1]; + continue; + } + const handle = line.match(/^\s*[-*]\s+@?([A-Za-z0-9-]+)\s*$/); + if (label && handle) { + if (!rosters.has(label)) rosters.set(label, new Set()); + rosters.get(label).add(handle[1].toLowerCase()); + } + } + + const target = context.payload.pull_request ?? context.payload.issue; + const author = target.user.login.toLowerCase(); + const labels = [...rosters.keys()].filter(name => rosters.get(name).has(author)); + + const blocked = labels.filter(name => !ALLOWED_LABELS.includes(name)); + if (blocked.length) { + core.warning(`Skipping roster label(s) missing from ALLOWED_LABELS: ${blocked.join(', ')}`); + } + const allowed = labels.filter(name => ALLOWED_LABELS.includes(name)); + if (!allowed.length) { + return; + } + + await github.rest.issues.addLabels({ + owner, + repo, + issue_number: target.number, + labels: allowed, + }); diff --git a/.github/workflows/utsc2026-labeler.yml b/.github/workflows/utsc2026-labeler.yml deleted file mode 100644 index fae6ee421d4..00000000000 --- a/.github/workflows/utsc2026-labeler.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: "UTSC 2026 Student Labeler" - -on: # zizmor: ignore[dangerous-triggers] - needs pull_request_target for a - # writable token on fork PRs; the script only reads the opaque author - # login/number fields below, never PR-controlled free text (title, body, - # branch), and nothing is interpolated into a shell `run:` - pull_request_target: - branches: [master] - types: [opened] - issues: - types: [opened] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - label: - name: Label - permissions: - contents: read - issues: write # to add the utsc2026 label to a matching issue - pull-requests: write # to add the utsc2026 label to a matching PR - runs-on: ubuntu-slim - steps: - - name: Label if author is a UTSC 2026 student - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const { data: file } = await github.rest.repos.getContent({ - owner: context.repo.owner, - repo: context.repo.repo, - path: '.github/utsc2026-students.yml', - }); - const students = Buffer.from(file.content, 'base64') - .toString('utf8') - .split('\n') - .map(line => line.replace(/#.*/, '').trim()) - .filter(line => line.startsWith('- ')) - .map(line => line.slice(2).trim().toLowerCase()); - - const target = context.payload.pull_request ?? context.payload.issue; - const author = target.user.login.toLowerCase(); - if (!students.includes(author)) { - return; - } - - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: target.number, - labels: ['utsc2026'], - }); diff --git a/docs/developer_docs/contributing/guidelines.md b/docs/developer_docs/contributing/guidelines.md index e217c66fd40..ce93930abe7 100644 --- a/docs/developer_docs/contributing/guidelines.md +++ b/docs/developer_docs/contributing/guidelines.md @@ -157,6 +157,15 @@ If an issue/PR has been inactive for at least 30 days, it will be closed. If it When creating a PR, if you're aiming to have it included in a specific release, please tag it with the version label. For example, to have a PR considered for inclusion in Superset 1.1 use the label `v1.1`. +### Automatically Applied Labels + +Some labels are applied by CI rather than by hand. Labels that depend on who opened the PR or issue (for example `utsc2026`, for students contributing through a university course) are driven by rosters kept on the project wiki, so committers can update them without opening a PR: + +- [Labeling Automation](https://github.com/apache/superset/wiki/Labeling-Automation) lists every wiki page that drives labels. +- [Label Rosters](https://github.com/apache/superset/wiki/Label-Rosters) maps labels to GitHub handles. Adding a handle there takes effect within a few minutes. + +The wiki is edited by committers, and each page keeps its full edit history. A label must also be on the allowlist in `.github/workflows/author-labeler.yml` before a roster can apply it, so adding a new roster label still takes a PR. + ## Revert Guidelines Reverting changes that are causing issues in the master branch is a normal and expected part of the development process. In an open source community, the ramifications of a change cannot always be fully understood. With that in mind, here are some considerations to keep in mind when considering a revert:
