Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Auto-labeler configuration for pull requests
# Uses actions/labeler to apply labels based on changed file paths
# https://github.com/actions/labeler

documentation:
- changed-files:
- any-glob-to-any-file:
- "**/*.md"
- "docs/**"

ci/cd:
- changed-files:
- any-glob-to-any-file:
- ".github/**"

leaderboard:
- changed-files:
- any-glob-to-any-file:
- "LEADERBOARD.md"
- ".github/scripts/generate-leaderboard.js"

week-1:
- changed-files:
- any-glob-to-any-file:
- "challenges/week-1/**"
- "challenges/week-1.md"

week-2:
- changed-files:
- any-glob-to-any-file:
- "challenges/week-2/**"
- "challenges/week-2.md"

week-3:
- changed-files:
- any-glob-to-any-file:
- "challenges/week-3/**"
- "challenges/week-3.md"

week-4:
- changed-files:
- any-glob-to-any-file:
- "challenges/week-4/**"
- "challenges/week-4.md"

challenge:
- changed-files:
- any-glob-to-any-file:
- "challenges/**"

dependencies:
- changed-files:
- any-glob-to-any-file:
- "package.json"
- "package-lock.json"
- "yarn.lock"
- "pnpm-lock.yaml"
125 changes: 125 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Label definitions for ReactSphere Community Challenges
# Used by the label-sync workflow to keep labels in sync with this file

# ── Status labels ──────────────────────────────────────────────────────────────
- name: "needs-review"
color: "fbca04"
description: "Awaiting review from maintainers"

- name: "in-progress"
color: "0075ca"
description: "Work is currently in progress"

- name: "approved"
color: "0e8a16"
description: "Submission or change has been approved"

- name: "needs-changes"
color: "e4e669"
description: "Changes requested before merging"

- name: "blocked"
color: "b60205"
description: "Blocked by another issue or external dependency"

# ── Type labels ────────────────────────────────────────────────────────────────
- name: "bug"
color: "d73a4a"
description: "Something isn't working"

- name: "enhancement"
color: "a2eeef"
description: "New feature or improvement to existing functionality"

- name: "feature"
color: "0075ca"
description: "Request for a new feature"

- name: "documentation"
color: "0075ca"
description: "Improvements or additions to documentation"

- name: "question"
color: "d876e3"
description: "Further information is requested"

- name: "discussion"
color: "e4e669"
description: "Open for community discussion"

# ── Challenge labels ───────────────────────────────────────────────────────────
- name: "challenge"
color: "6f42c1"
description: "Related to a weekly challenge"

- name: "submission"
color: "1d76db"
description: "A challenge submission"

- name: "week-1"
color: "c5def5"
description: "Week 1 challenge"

- name: "week-2"
color: "c5def5"
description: "Week 2 challenge"

- name: "week-3"
color: "c5def5"
description: "Week 3 challenge"

- name: "week-4"
color: "c5def5"
description: "Week 4 challenge"

# ── Difficulty labels ──────────────────────────────────────────────────────────
- name: "beginner"
color: "0e8a16"
description: "Beginner-level challenge or task"

- name: "intermediate"
color: "fbca04"
description: "Intermediate-level challenge or task"

- name: "advanced"
color: "d93f0b"
description: "Advanced-level challenge or task"

# ── Contribution labels ────────────────────────────────────────────────────────
- name: "good first issue"
color: "7057ff"
description: "Good for newcomers"

- name: "help wanted"
color: "008672"
description: "Extra attention is needed"

- name: "hacktoberfest"
color: "ff7518"
description: "Valid Hacktoberfest contribution"

# ── Resolution labels ──────────────────────────────────────────────────────────
- name: "duplicate"
color: "cfd3d7"
description: "This issue or pull request already exists"

- name: "invalid"
color: "e4e669"
description: "This doesn't seem right"

- name: "wontfix"
color: "ffffff"
description: "This will not be worked on"

# ── Area labels ────────────────────────────────────────────────────────────────
- name: "leaderboard"
color: "f9d0c4"
description: "Related to the leaderboard"

- name: "ci/cd"
color: "0075ca"
description: "Related to CI/CD workflows and automation"

- name: "dependencies"
color: "0366d6"
description: "Pull requests that update a dependency file"
79 changes: 79 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Auto Label

on:
pull_request:
types: [opened, synchronize, reopened]
issues:
types: [opened, edited]

permissions:
contents: read
issues: write
pull-requests: write

jobs:
# ── Auto-label pull requests based on changed files ──────────────────────────
label-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Label PR by changed files
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yml
sync-labels: false

# ── Auto-label issues based on title / body keywords ─────────────────────────
label-issue:
if: github.event_name == 'issues'
runs-on: ubuntu-latest
steps:
- name: Apply labels to issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue;
const title = (issue.title || '').toLowerCase();
const body = (issue.body || '').toLowerCase();
const text = title + ' ' + body;
const labels = [];

const add = (label) => labels.push(label);

// Type detection
if (/\bbug\b|error|crash|broken|not working/.test(text)) add('bug');
if (/\bfeature\b|feature request|add support|new feature/.test(text)) add('feature');
if (/\benhancement\b|improve|improvement/.test(text)) add('enhancement');
if (/\bdoc(s|umentation)?\b|readme|typo/.test(text)) add('documentation');
if (/\bquestion\b|how (do|to|can)|help me|confused/.test(text)) add('question');

// Challenge / submission detection
if (/\bchallenge\b/.test(text)) add('challenge');
if (/\bsubmission\b/.test(text)) add('submission');

// Week detection
const weekMatch = text.match(/\bweek[-\s]?(\d+)\b/);
if (weekMatch) add(`week-${weekMatch[1]}`);

// Difficulty detection
if (/\bbeginner\b/.test(text)) add('beginner');
if (/\bintermediate\b/.test(text)) add('intermediate');
if (/\badvanced\b/.test(text)) add('advanced');

// Good first issue / help wanted
if (/good first issue|starter|newcomer|first (pr|contribution)/.test(text)) add('good first issue');
if (/help wanted|looking for help/.test(text)) add('help wanted');

// Leaderboard
if (/\bleaderboard\b/.test(text)) add('leaderboard');

if (labels.length === 0) return;

await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels,
});
27 changes: 27 additions & 0 deletions .github/workflows/label-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Sync Labels

on:
push:
branches:
- main
- master
paths:
- .github/labels.yml
workflow_dispatch:

permissions:
issues: write

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Sync labels
uses: EndBug/label-sync@v2
with:
config-file: .github/labels.yml
delete-other-labels: false
token: ${{ secrets.GITHUB_TOKEN }}