From a0bfb54f3cc788a3ed27ab1d720e5a6ee9e63e2a Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Sat, 4 Oct 2025 00:20:00 -0500 Subject: [PATCH 1/5] Add automated pull request labeling workflow --- .github/labeler.yml | 126 ++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 25 +++++++ 2 files changed, 151 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000000..f18bf015e84 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,126 @@ +# Configuration for GitHub Actions Labeler +# https://github.com/actions/labeler + +# Core library files +'area: core': + - changed-files: + - any-glob-to-any-file: ['lib/**/*'] + +# Application logic +'area: application': + - changed-files: + - any-glob-to-any-file: ['lib/application.js'] + +# Request/Response handling +'area: request': + - changed-files: + - any-glob-to-any-file: ['lib/request.js'] + +'area: response': + - changed-files: + - any-glob-to-any-file: ['lib/response.js'] + +# Routing +'area: router': + - changed-files: + - any-glob-to-any-file: ['lib/router/**/*'] + +# Views and templating +'area: view': + - changed-files: + - any-glob-to-any-file: ['lib/view.js'] + +# Utilities +'area: utils': + - changed-files: + - any-glob-to-any-file: ['lib/utils.js'] + +# Tests +'area: tests': + - changed-files: + - any-glob-to-any-file: + - 'test/**/*' + - '**/*.test.js' + - '**/*.spec.js' + +# Examples +'area: examples': + - changed-files: + - any-glob-to-any-file: ['examples/**/*'] + +# Documentation +'area: docs': + - changed-files: + - any-glob-to-any-file: + - '*.md' + - '**/*.md' + - 'docs/**/*' + +# Configuration files +'area: config': + - changed-files: + - any-glob-to-any-file: + - 'package.json' + - 'package-lock.json' + - '.eslintrc*' + - '.gitignore' + - '.github/**/*' + - '*.json' + - '*.yml' + - '*.yaml' + +# Benchmarks +'area: benchmarks': + - changed-files: + - any-glob-to-any-file: ['benchmarks/**/*'] + +# Security related +'area: security': + - changed-files: + - any-glob-to-any-file: + - 'SECURITY.md' + - '.github/workflows/codeql.yml' + - '.github/workflows/scorecard.yml' + +# CI/CD +'area: 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' + +# Size labels based on number of files changed +'size: small': + - changed-files: + - any-glob-to-any-file: ['**/*'] + - count: '1-3' + +'size: medium': + - changed-files: + - any-glob-to-any-file: ['**/*'] + - count: '4-10' + +'size: large': + - changed-files: + - any-glob-to-any-file: ['**/*'] + - count: '11-50' + +'size: extra-large': + - changed-files: + - any-glob-to-any-file: ['**/*'] + - count: '51+' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000000..526a1d11780 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,25 @@ +name: "Pull Request Labeler" + +on: + pull_request: + types: [opened, synchronize] + +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 From fdfc29c7ebde6ade5b9732906c3ae519d5e68751 Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Sat, 4 Oct 2025 00:30:11 -0500 Subject: [PATCH 2/5] Fix labeler configuration syntax: --- .github/labeler.yml | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index f18bf015e84..27e7b7d1312 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -104,23 +104,5 @@ - 'lib/express.js' - 'lib/application.js' -# Size labels based on number of files changed -'size: small': - - changed-files: - - any-glob-to-any-file: ['**/*'] - - count: '1-3' - -'size: medium': - - changed-files: - - any-glob-to-any-file: ['**/*'] - - count: '4-10' - -'size: large': - - changed-files: - - any-glob-to-any-file: ['**/*'] - - count: '11-50' - -'size: extra-large': - - changed-files: - - any-glob-to-any-file: ['**/*'] - - count: '51+' +# Note: Size labels based on file count are not supported in this version of the labeler action +# The labeler will focus on area-based labels instead From f47b1c82570cab1c9785607db06cdf67e5389fda Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Sat, 4 Oct 2025 00:41:34 -0500 Subject: [PATCH 3/5] uploaded the colors for labels --- .github/labeler.yml | 20 ++++++++++++++++++-- create-labels.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100755 create-labels.sh diff --git a/.github/labeler.yml b/.github/labeler.yml index 27e7b7d1312..1b32960a8c1 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -104,5 +104,21 @@ - 'lib/express.js' - 'lib/application.js' -# Note: Size labels based on file count are not supported in this version of the labeler action -# The labeler will focus on area-based labels instead +# Size labels - These will be created manually with the script +# The labeler action doesn't support count-based labeling in this version +# but we can still reference them for future use +'size: small': + - changed-files: + - any-glob-to-any-file: ['**/*'] + +'size: medium': + - changed-files: + - any-glob-to-any-file: ['**/*'] + +'size: large': + - changed-files: + - any-glob-to-any-file: ['**/*'] + +'size: extra-large': + - changed-files: + - any-glob-to-any-file: ['**/*'] diff --git a/create-labels.sh b/create-labels.sh new file mode 100755 index 00000000000..bc48b93b2df --- /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..." + +# Area labels - Different shades of blue/teal +gh label create "area: core" --color "0052cc" --description "Changes to core library files" --force +gh label create "area: application" --color "1f77b4" --description "Changes to application logic" --force +gh label create "area: request" --color "2ca02c" --description "Changes to request handling" --force +gh label create "area: response" --color "ff7f0e" --description "Changes to response handling" --force +gh label create "area: router" --color "d62728" --description "Changes to routing functionality" --force +gh label create "area: view" --color "9467bd" --description "Changes to view/templating" --force +gh label create "area: utils" --color "8c564b" --description "Changes to utility functions" --force +gh label create "area: tests" --color "e377c2" --description "Changes to test files" --force +gh label create "area: examples" --color "7f7f7f" --description "Changes to example code" --force +gh label create "area: docs" --color "17becf" --description "Changes to documentation" --force +gh label create "area: config" --color "bcbd22" --description "Changes to configuration files" --force +gh label create "area: benchmarks" --color "ff9896" --description "Changes to benchmark files" --force +gh label create "area: security" --color "c5b0d5" --description "Changes to security-related files" --force +gh label create "area: 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 "size: small" --color "00ff00" --description "Small changes (1-3 files)" --force +gh label create "size: medium" --color "ffff00" --description "Medium changes (4-10 files)" --force +gh label create "size: large" --color "ff8000" --description "Large changes (11-50 files)" --force +gh label create "size: 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" From 55c0afa35f676bad34b73ea2cd18bbc040b69ece Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Sat, 4 Oct 2025 00:52:00 -0500 Subject: [PATCH 4/5] fix the labeler issues --- .github/labeler.yml | 52 +++++++++++++-------------------------------- create-labels.sh | 38 ++++++++++++++++----------------- 2 files changed, 34 insertions(+), 56 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 1b32960a8c1..67ffe5cb258 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,42 +1,39 @@ -# Configuration for GitHub Actions Labeler -# https://github.com/actions/labeler - # Core library files -'area: core': +'core': - changed-files: - any-glob-to-any-file: ['lib/**/*'] # Application logic -'area: application': +'application': - changed-files: - any-glob-to-any-file: ['lib/application.js'] # Request/Response handling -'area: request': +'request': - changed-files: - any-glob-to-any-file: ['lib/request.js'] -'area: response': +'response': - changed-files: - any-glob-to-any-file: ['lib/response.js'] # Routing -'area: router': +'router': - changed-files: - any-glob-to-any-file: ['lib/router/**/*'] # Views and templating -'area: view': +'view': - changed-files: - any-glob-to-any-file: ['lib/view.js'] # Utilities -'area: utils': +'utils': - changed-files: - any-glob-to-any-file: ['lib/utils.js'] # Tests -'area: tests': +'tests': - changed-files: - any-glob-to-any-file: - 'test/**/*' @@ -44,12 +41,12 @@ - '**/*.spec.js' # Examples -'area: examples': +'examples': - changed-files: - any-glob-to-any-file: ['examples/**/*'] # Documentation -'area: docs': +'docs': - changed-files: - any-glob-to-any-file: - '*.md' @@ -57,7 +54,7 @@ - 'docs/**/*' # Configuration files -'area: config': +'config': - changed-files: - any-glob-to-any-file: - 'package.json' @@ -70,12 +67,12 @@ - '*.yaml' # Benchmarks -'area: benchmarks': +'benchmarks': - changed-files: - any-glob-to-any-file: ['benchmarks/**/*'] # Security related -'area: security': +'security': - changed-files: - any-glob-to-any-file: - 'SECURITY.md' @@ -83,7 +80,7 @@ - '.github/workflows/scorecard.yml' # CI/CD -'area: ci': +'ci': - changed-files: - any-glob-to-any-file: - '.github/workflows/**/*' @@ -102,23 +99,4 @@ - any-glob-to-any-file: - 'index.js' - 'lib/express.js' - - 'lib/application.js' - -# Size labels - These will be created manually with the script -# The labeler action doesn't support count-based labeling in this version -# but we can still reference them for future use -'size: small': - - changed-files: - - any-glob-to-any-file: ['**/*'] - -'size: medium': - - changed-files: - - any-glob-to-any-file: ['**/*'] - -'size: large': - - changed-files: - - any-glob-to-any-file: ['**/*'] - -'size: extra-large': - - changed-files: - - any-glob-to-any-file: ['**/*'] + - 'lib/application.js' \ No newline at end of file diff --git a/create-labels.sh b/create-labels.sh index bc48b93b2df..fbf4517a694 100755 --- a/create-labels.sh +++ b/create-labels.sh @@ -5,31 +5,31 @@ echo "Creating GitHub labels with custom colors..." -# Area labels - Different shades of blue/teal -gh label create "area: core" --color "0052cc" --description "Changes to core library files" --force -gh label create "area: application" --color "1f77b4" --description "Changes to application logic" --force -gh label create "area: request" --color "2ca02c" --description "Changes to request handling" --force -gh label create "area: response" --color "ff7f0e" --description "Changes to response handling" --force -gh label create "area: router" --color "d62728" --description "Changes to routing functionality" --force -gh label create "area: view" --color "9467bd" --description "Changes to view/templating" --force -gh label create "area: utils" --color "8c564b" --description "Changes to utility functions" --force -gh label create "area: tests" --color "e377c2" --description "Changes to test files" --force -gh label create "area: examples" --color "7f7f7f" --description "Changes to example code" --force -gh label create "area: docs" --color "17becf" --description "Changes to documentation" --force -gh label create "area: config" --color "bcbd22" --description "Changes to configuration files" --force -gh label create "area: benchmarks" --color "ff9896" --description "Changes to benchmark files" --force -gh label create "area: security" --color "c5b0d5" --description "Changes to security-related files" --force -gh label create "area: ci" --color "c49c94" --description "Changes to CI/CD workflows" --force +# 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 "size: small" --color "00ff00" --description "Small changes (1-3 files)" --force -gh label create "size: medium" --color "ffff00" --description "Medium changes (4-10 files)" --force -gh label create "size: large" --color "ff8000" --description "Large changes (11-50 files)" --force -gh label create "size: extra-large" --color "ff0000" --description "Extra large changes (51+ files)" --force +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" From 3bc7d4b19a1b52a01e9c0a5a08b19da62be76c49 Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Sun, 5 Oct 2025 15:13:53 -0500 Subject: [PATCH 5/5] Update pull request labeler trigger types Restrict labeler to only trigger on opened pull requests. --- .github/workflows/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 526a1d11780..983f322b048 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,7 +2,7 @@ name: "Pull Request Labeler" on: pull_request: - types: [opened, synchronize] + types: [opened] permissions: contents: read