diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000000..67ffe5cb258 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,102 @@ +# Core library files +'core': + - changed-files: + - any-glob-to-any-file: ['lib/**/*'] + +# Application logic +'application': + - changed-files: + - any-glob-to-any-file: ['lib/application.js'] + +# Request/Response handling +'request': + - changed-files: + - any-glob-to-any-file: ['lib/request.js'] + +'response': + - changed-files: + - any-glob-to-any-file: ['lib/response.js'] + +# Routing +'router': + - changed-files: + - any-glob-to-any-file: ['lib/router/**/*'] + +# Views and templating +'view': + - changed-files: + - any-glob-to-any-file: ['lib/view.js'] + +# Utilities +'utils': + - changed-files: + - any-glob-to-any-file: ['lib/utils.js'] + +# Tests +'tests': + - changed-files: + - any-glob-to-any-file: + - 'test/**/*' + - '**/*.test.js' + - '**/*.spec.js' + +# Examples +'examples': + - changed-files: + - any-glob-to-any-file: ['examples/**/*'] + +# Documentation +'docs': + - changed-files: + - any-glob-to-any-file: + - '*.md' + - '**/*.md' + - 'docs/**/*' + +# Configuration files +'config': + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + - '.eslintrc*' + - '.gitignore' + - '.github/**/*' + - '*.json' + - '*.yml' + - '*.yaml' + +# Benchmarks +'benchmarks': + - changed-files: + - any-glob-to-any-file: ['benchmarks/**/*'] + +# Security related +'security': + - changed-files: + - any-glob-to-any-file: + - 'SECURITY.md' + - '.github/workflows/codeql.yml' + - '.github/workflows/scorecard.yml' + +# CI/CD +'ci': + - changed-files: + - any-glob-to-any-file: + - '.github/workflows/**/*' + - '.github/dependabot.yml' + +# Dependencies +'dependencies': + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + +# Breaking changes (based on certain core files) +'breaking change': + - changed-files: + - any-glob-to-any-file: + - 'index.js' + - 'lib/express.js' + - 'lib/application.js' \ No newline at end of file diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000000..983f322b048 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,25 @@ +name: "Pull Request Labeler" + +on: + pull_request: + types: [opened] + +permissions: + contents: read + pull-requests: write + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + + - name: Label Pull Request + uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + configuration-path: '.github/labeler.yml' + sync-labels: true diff --git a/create-labels.sh b/create-labels.sh new file mode 100755 index 00000000000..fbf4517a694 --- /dev/null +++ b/create-labels.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Script to create GitHub labels with custom colors for the Express.js repository +# Run this script with: bash create-labels.sh + +echo "Creating GitHub labels with custom colors..." + +# Component labels - Different vibrant colors +gh label create "core" --color "0052cc" --description "Changes to core library files" --force +gh label create "application" --color "1f77b4" --description "Changes to application logic" --force +gh label create "request" --color "2ca02c" --description "Changes to request handling" --force +gh label create "response" --color "ff7f0e" --description "Changes to response handling" --force +gh label create "router" --color "d62728" --description "Changes to routing functionality" --force +gh label create "view" --color "9467bd" --description "Changes to view/templating" --force +gh label create "utils" --color "8c564b" --description "Changes to utility functions" --force +gh label create "tests" --color "e377c2" --description "Changes to test files" --force +gh label create "examples" --color "7f7f7f" --description "Changes to example code" --force +gh label create "docs" --color "17becf" --description "Changes to documentation" --force +gh label create "config" --color "bcbd22" --description "Changes to configuration files" --force +gh label create "benchmarks" --color "ff9896" --description "Changes to benchmark files" --force +gh label create "security" --color "c5b0d5" --description "Changes to security-related files" --force +gh label create "ci" --color "c49c94" --description "Changes to CI/CD workflows" --force + +# Special labels - Distinct colors +gh label create "dependencies" --color "0366d6" --description "Changes to package dependencies" --force +gh label create "breaking change" --color "b60205" --description "Changes that may break compatibility" --force + +# Size labels - Gradient from green to red +gh label create "small" --color "00ff00" --description "Small changes (1-3 files)" --force +gh label create "medium" --color "ffff00" --description "Medium changes (4-10 files)" --force +gh label create "large" --color "ff8000" --description "Large changes (11-50 files)" --force +gh label create "extra-large" --color "ff0000" --description "Extra large changes (51+ files)" --force + +echo "✅ All labels created successfully!" +echo "You can view them at: https://github.com/$(gh repo view --json owner,name -q '.owner.login + \"/\" + .name')/labels"