From 255bd414e10e0626d7cc25f7a7e5be2b2ffad4d9 Mon Sep 17 00:00:00 2001 From: aitechnology <40792067+vsn411@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:57:31 +0000 Subject: [PATCH 1/2] leaderboard: name the levels Gold, Silver and Bronze --- CONTRIBUTING.md | 10 +++++----- README.md | 2 +- scripts/leaderboard.py | 8 ++++---- tests/test_leaderboard.py | 14 +++++++------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06a740b..d51d297 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,11 +55,11 @@ based on the difficulty of the issue they close: | `difficulty: medium` | 6 | | `difficulty: low` | 3 | -| Level | Points needed | -|---------|--------------:| -| Level 1 | 100 | -| Level 2 | 50 | -| Level 3 | 25 | +| Level | Points needed | +|--------|--------------:| +| Gold | 100 | +| Silver | 50 | +| Bronze | 25 | How it works: diff --git a/README.md b/README.md index 9b9a7c4..b5bf5e7 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ PRs welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) and Hackathon? Issues tagged [`hackathon`](https://github.com/secfoo-com/secfoo/issues?q=is%3Aopen+label%3Ahackathon) are open for contribution, and merged PRs earn points on the [contributor leaderboard](https://github.com/secfoo-com/secfoo/blob/leaderboard/LEADERBOARD.md) -(10 / 6 / 3 for hard / medium / low issues; levels at 25, 50 and 100). +(10 / 6 / 3 for hard / medium / low issues; Bronze, Silver and Gold at 25, 50 and 100). Hackathon leaderboard diff --git a/scripts/leaderboard.py b/scripts/leaderboard.py index b80f13a..5b0674a 100644 --- a/scripts/leaderboard.py +++ b/scripts/leaderboard.py @@ -6,7 +6,7 @@ difficulty label: ``difficulty: hard`` = 10, ``difficulty: medium`` = 6, ``difficulty: low`` = 3. * Each issue is scored once, for the first merged PR that closed it. -* Contributors reach Level 3 at 25 points, Level 2 at 50, Level 1 at 100. +* Contributors reach Bronze at 25 points, Silver at 50, Gold at 100. * Merged PRs that close an issue without a difficulty label earn nothing yet; they're listed under "Needs a difficulty label" so a maintainer can add one. The board recomputes from scratch on every run, so late labels count. @@ -41,9 +41,9 @@ # Highest level first. A contributor holds the first level whose threshold # they meet; below the lowest threshold they have no level yet. LEVELS = [ - {"name": "Level 1", "min_points": 100}, - {"name": "Level 2", "min_points": 50}, - {"name": "Level 3", "min_points": 25}, + {"name": "Gold", "min_points": 100}, + {"name": "Silver", "min_points": 50}, + {"name": "Bronze", "min_points": 25}, ] GRAPHQL_URL = "https://api.github.com/graphql" diff --git a/tests/test_leaderboard.py b/tests/test_leaderboard.py index 4594c6b..3ad0c02 100644 --- a/tests/test_leaderboard.py +++ b/tests/test_leaderboard.py @@ -56,11 +56,11 @@ def test_points_and_levels(): assert leaderboard.POINTS == {"hard": 10, "medium": 6, "low": 3} assert leaderboard.level_for(0) is None assert leaderboard.level_for(24) is None - assert leaderboard.level_for(25) == "Level 3" - assert leaderboard.level_for(50) == "Level 2" - assert leaderboard.level_for(99) == "Level 2" - assert leaderboard.level_for(100) == "Level 1" - assert leaderboard.next_level_for(30) == {"name": "Level 2", "min_points": 50} + assert leaderboard.level_for(25) == "Bronze" + assert leaderboard.level_for(50) == "Silver" + assert leaderboard.level_for(99) == "Silver" + assert leaderboard.level_for(100) == "Gold" + assert leaderboard.next_level_for(30) == {"name": "Silver", "min_points": 50} assert leaderboard.next_level_for(150) is None @@ -116,7 +116,7 @@ def test_levels_reached(): issues = [issue(100 + i, "difficulty: hard") for i in range(10)] board = leaderboard.score([pr(1, "alice", "2026-11-08T10:00:00Z", issues)], REPO) assert board["contributors"][0]["points"] == 100 - assert board["contributors"][0]["level"] == "Level 1" + assert board["contributors"][0]["level"] == "Gold" def test_markdown_badge_and_comment_render(): @@ -138,7 +138,7 @@ def test_markdown_badge_and_comment_render(): comment = leaderboard.render_pr_comment(board, 1) assert "+10 points" in comment assert "alice now has **10 points** (rank #1)." in comment - assert "15 more to reach Level 3" in comment + assert "15 more to reach Bronze" in comment pending = leaderboard.render_pr_comment(board, 2) assert "no `difficulty:` label yet" in pending From dd51343bbfd420510841414de32344b81c60e928 Mon Sep 17 00:00:00 2001 From: aitechnology <40792067+vsn411@users.noreply.github.com> Date: Wed, 11 Nov 2026 20:01:27 +0000 Subject: [PATCH 2/2] issue-difficulty: skip tracking issues --- .github/workflows/issue-difficulty.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/issue-difficulty.yml b/.github/workflows/issue-difficulty.yml index 4ffb781..02242b1 100644 --- a/.github/workflows/issue-difficulty.yml +++ b/.github/workflows/issue-difficulty.yml @@ -38,13 +38,15 @@ jobs: gh label create "difficulty: medium" --force --color d93f0b --description "Leaderboard: 6 points when the PR closing this is merged" gh label create "difficulty: low" --force --color 0e8a16 --description "Leaderboard: 3 points when the PR closing this is merged" gh label create "needs difficulty" --force --color fbca04 --description "Maintainer: add difficulty: hard, medium or low so this can be scored" + gh label create "tracking" --force --color c5def5 --description "Umbrella or announcement issue; not a task, not scored" - name: Flag or clear this issue if: github.event_name == 'issues' env: ISSUE: ${{ github.event.issue.number }} run: | - if gh issue view "$ISSUE" --json labels --jq '.labels[].name' | grep -qiE '^difficulty'; then + # Tracking/umbrella issues aren't tasks, so they don't need a difficulty. + if gh issue view "$ISSUE" --json labels --jq '.labels[].name' | grep -qiE '^(difficulty|tracking$)'; then gh issue edit "$ISSUE" --remove-label "needs difficulty" || true else gh issue edit "$ISSUE" --add-label "needs difficulty" @@ -54,7 +56,7 @@ jobs: if: github.event_name == 'workflow_dispatch' && inputs.backfill run: | gh issue list --state open --limit 500 --json number,labels \ - --jq '.[] | select(([.labels[].name] | map(test("^difficulty"; "i")) | any) | not) | .number' \ + --jq '.[] | select(([.labels[].name] | map(test("^(difficulty|tracking$)"; "i")) | any) | not) | .number' \ | while read -r number; do echo "#$number needs a difficulty label" gh issue edit "$number" --add-label "needs difficulty"