Skip to content

Commit bc6d147

Browse files
committed
chore(ci): replace Dosu stale and size labeling with native workflows
Add two GitHub-native workflows ahead of disabling the Dosu app and migrate size labels to canonical k8s namespacing. - .github/workflows/stale.yaml uses actions/stale@v10 to manage the lifecycle/stale and lifecycle/rotten lifecycle. Daily cron, 60d before stale, 14d before close. Issue/PR exempt lists differ on purpose: an accepted issue (triage/accepted) is a known long-tail task, not stale; a held PR (do-not-merge/hold) is paused intentionally. Priority/security/regression labels protect issues someone explicitly decided to keep visible. - .github/workflows/pr-size.yaml uses actions/github-script@v7 to apply size/* labels based on diff line count. Thresholds match the descriptions in .github/labels.yml. Inline ignore patterns skip vendored deps, kubebuilder/openapi inline generated files (zz_generated.{deepcopy,conversion,defaults,openapi}.go), whole code-generated trees (any path under generated/ or *.pb.go), vendored Helm charts, and lockfiles. Concurrency group keyed on PR number with cancel-in-progress: true. removeLabel is wrapped in try/catch tolerating 404 for races between event payload and execution. - Migrate the six size labels from legacy 'size:X' (colon) to canonical 'size/X' (slash) via aliases in .github/labels.yml. The colon form was an artefact of the previous sizing bot's output; with the bot replaced and namespacing already used everywhere else (kind/, area/, priority/, triage/, lifecycle/, do-not-merge/, security/), the slash form aligns with the rest of the scheme. The alias migration preserves IDs and keeps every existing labelled PR pointing at the renamed entry. pr-size.yaml emits the new 'size/' form from day 1 and accepts either prefix when looking up the previous size label, to handle the brief window between PR merge and the labels-sync run. Verification of zero hard dependencies on Dosu in workflows: only backport.yaml (consumes backport*, applied by humans only) and pull-requests*.yaml + tags.yaml (consume release, applied by tags workflow itself) — none of those labels come from Dosu. The lgtm label (33/33 in last 100 PRs from Dosu, none from humans) is intentionally not replaced in this PR — observe reviewer behaviour for 7 days after Dosu is disabled and decide whether a pull_request_review-on-approve workflow is needed. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent bdf23e6 commit bc6d147

3 files changed

Lines changed: 163 additions & 8 deletions

File tree

‎.github/labels.yml‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# area/ subsystem; extensible — add when 3+ open issues exist
2222
# do-not-merge/ PR merge blockers
2323
# security/ security-finding severity and status (Cozystack-specific)
24-
# size: PR size (auto-applied)
24+
# size/ PR size (auto-applied)
2525
#
2626
# `aliases:` lets EndBug/label-sync rename existing labels without losing
2727
# references on already-tagged issues and PRs.
@@ -295,32 +295,38 @@
295295
description: Indicates a non-member PR is safe to run CI on
296296

297297
# ──────────────────────────────────────────────
298-
# size: — PR size (auto-applied by sizing bot)
298+
# size/ — PR size (auto-applied by .github/workflows/pr-size.yaml)
299299
# ──────────────────────────────────────────────
300300

301-
- name: 'size:XS'
301+
- name: size/XS
302302
color: '00ff00'
303303
description: This PR changes 0-9 lines, ignoring generated files
304+
aliases: ['size:XS']
304305

305-
- name: 'size:S'
306+
- name: size/S
306307
color: '77b800'
307308
description: This PR changes 10-29 lines, ignoring generated files
309+
aliases: ['size:S']
308310

309-
- name: 'size:M'
311+
- name: size/M
310312
color: 'ebb800'
311313
description: This PR changes 30-99 lines, ignoring generated files
314+
aliases: ['size:M']
312315

313-
- name: 'size:L'
316+
- name: size/L
314317
color: 'eb9500'
315318
description: This PR changes 100-499 lines, ignoring generated files
319+
aliases: ['size:L']
316320

317-
- name: 'size:XL'
321+
- name: size/XL
318322
color: 'ff823f'
319323
description: This PR changes 500-999 lines, ignoring generated files
324+
aliases: ['size:XL']
320325

321-
- name: 'size:XXL'
326+
- name: size/XXL
322327
color: 'ffb8b8'
323328
description: This PR changes 1000+ lines, ignoring generated files
329+
aliases: ['size:XXL']
324330

325331
# ──────────────────────────────────────────────
326332
# security/ — security-finding severity and status

‎.github/workflows/pr-size.yaml‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: PR size label
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
concurrency:
12+
group: pr-size-${{ github.event.pull_request.number }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
size:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const pr = context.payload.pull_request;
23+
24+
// Skip files that should not count as "real diff" — they are produced by tools,
25+
// not authored by humans, and including them lies to reviewers about review effort:
26+
// - vendored Go deps,
27+
// - kubebuilder/openapi inline generated files (zz_generated.{deepcopy,conversion,defaults,openapi}.go),
28+
// - whole code-generated trees from client-gen / lister-gen / applyconfiguration-gen
29+
// and protobuf (any path under a `generated/` directory or ending in `.pb.go`),
30+
// - vendored Helm charts,
31+
// - lockfiles.
32+
const isIgnored = (path) =>
33+
path.startsWith('vendor/') ||
34+
/\bzz_generated\.[^/]*\.go$/.test(path) ||
35+
/(^|\/)generated\//.test(path) ||
36+
path.endsWith('.pb.go') ||
37+
/^packages\/system\/[^/]+\/charts\//.test(path) ||
38+
path === 'go.sum' || path.endsWith('/go.sum') ||
39+
path.endsWith('.lock') || path.endsWith('.lockb');
40+
41+
const files = await github.paginate(github.rest.pulls.listFiles, {
42+
owner: context.repo.owner,
43+
repo: context.repo.repo,
44+
pull_number: pr.number,
45+
});
46+
const lines = files
47+
.filter((f) => !isIgnored(f.filename))
48+
.reduce((acc, f) => acc + (f.additions || 0) + (f.deletions || 0), 0);
49+
50+
// Thresholds match the descriptions of size/* labels in .github/labels.yml.
51+
const bucket =
52+
lines <= 9 ? 'XS' :
53+
lines <= 29 ? 'S' :
54+
lines <= 99 ? 'M' :
55+
lines <= 499 ? 'L' :
56+
lines <= 999 ? 'XL' : 'XXL';
57+
const target = `size/${bucket}`;
58+
59+
// Match both legacy "size:" and canonical "size/" during the migration window.
60+
const existing = (pr.labels || []).map((l) => l.name);
61+
const oldSizes = existing.filter((n) => n.startsWith('size/') || n.startsWith('size:'));
62+
const alreadyTarget = oldSizes.includes(target);
63+
64+
// Remove every size/* label that is not the target. Tolerate 404 — concurrent
65+
// runs or manual edits between event payload and execution can race here.
66+
for (const name of oldSizes) {
67+
if (name === target) continue;
68+
try {
69+
await github.rest.issues.removeLabel({
70+
owner: context.repo.owner,
71+
repo: context.repo.repo,
72+
issue_number: pr.number,
73+
name,
74+
});
75+
} catch (e) {
76+
if (e.status !== 404) throw e;
77+
core.info(`label ${name} already gone (404)`);
78+
}
79+
}
80+
81+
if (alreadyTarget && oldSizes.length === 1) {
82+
core.info(`PR #${pr.number}: ${lines} lines, label already ${target}`);
83+
return;
84+
}
85+
if (!alreadyTarget) {
86+
await github.rest.issues.addLabels({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
issue_number: pr.number,
90+
labels: [target],
91+
});
92+
}
93+
core.info(`PR #${pr.number}: ${lines} lines -> ${target}`);

‎.github/workflows/stale.yaml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Stale issues
2+
3+
on:
4+
schedule:
5+
- cron: '37 4 * * *' # daily at 04:37 UTC
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: stale
15+
cancel-in-progress: false
16+
17+
jobs:
18+
stale:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/stale@v10
22+
with:
23+
stale-issue-label: lifecycle/stale
24+
stale-pr-label: lifecycle/stale
25+
close-issue-label: lifecycle/rotten
26+
close-pr-label: lifecycle/rotten
27+
# Exempt lists differ on purpose: issues sit longer than PRs by nature.
28+
# An accepted issue (`triage/accepted`) is a known long-tail task, not stale;
29+
# a held PR (`do-not-merge/hold`) is paused intentionally and shouldn't auto-close.
30+
# Priority/security/regression labels protect issues that someone explicitly
31+
# decided to keep visible.
32+
exempt-issue-labels: >-
33+
lifecycle/frozen,epic,
34+
priority/critical-urgent,priority/important-soon,
35+
security/critical,security/high,security/confirmed,
36+
security/triage-needed,security/in-progress,
37+
triage/accepted,kind/regression
38+
exempt-pr-labels: >-
39+
lifecycle/frozen,do-not-merge/hold,
40+
backport,backport-previous
41+
days-before-stale: 60
42+
days-before-close: 14
43+
operations-per-run: 100
44+
remove-stale-when-updated: true
45+
stale-issue-message: |
46+
This issue has had no activity for 60 days and was marked `lifecycle/stale`.
47+
It will be closed in 14 days unless commented or labelled `lifecycle/frozen`.
48+
stale-pr-message: |
49+
This PR has had no activity for 60 days and was marked `lifecycle/stale`.
50+
It will be closed in 14 days unless commented or labelled `lifecycle/frozen`.
51+
close-issue-message: |
52+
Closed because no activity followed the `lifecycle/stale` warning.
53+
Reopen if the issue is still relevant.
54+
close-pr-message: |
55+
Closed because no activity followed the `lifecycle/stale` warning.
56+
Reopen if the change is still wanted.

0 commit comments

Comments
 (0)