forked from mdn/content
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): Add labels to PRs based on LoC / num files changed (mdn#31729
) * chore(ci): Add labels to PRs based on LoC / num files changed * chore(ci): Make label-by-size depend on label by path, only run on opened & syncd PRs against main
- Loading branch information
Showing
2 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Configuration for PR Size Labeler | ||
|
||
# List of files to exclude from size calculation | ||
# Files matching these patterns will not be considered when calculating PR size | ||
exclude_files: | ||
- "files/en-us/_redirects.txt" | ||
- "files/en-us/_wikihistory.json" | ||
|
||
# Configuration for labeling based on the size of the Pull Request | ||
# Each entry defines a size label, along with thresholds for diff and file count | ||
label_configs: | ||
# Configuration for 'extra small' PRs | ||
- size: xs | ||
diff: 10 # Threshold for the total lines of code changed (additions + deletions) | ||
files: 1 # Threshold for the total number of files changed | ||
labels: ["size/xs"] # Labels to be applied for this size | ||
|
||
# Configuration for 'small' PRs | ||
- size: s | ||
diff: 25 | ||
files: 5 | ||
labels: ["size/s"] | ||
|
||
# Configuration for 'medium' PRs | ||
- size: m | ||
diff: 100 | ||
files: 10 | ||
# Additional labels can be added, e.g.; | ||
# labels: ["size/m", "pairing-wanted"] | ||
labels: ["size/m"] | ||
|
||
# Configuration for 'large' PRs | ||
- size: l | ||
diff: 250 | ||
files: 25 | ||
labels: ["size/l"] | ||
|
||
# Configuration for 'extra large' PRs | ||
- size: xl | ||
diff: 500 | ||
files: 50 | ||
labels: ["size/xl"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
name: "Pull request labeler" | ||
name: Pull request labeler | ||
|
||
on: | ||
- pull_request_target | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
triage: | ||
# Docs: https://github.com/actions/labeler | ||
label-by-path: | ||
# do not run on forks | ||
if: github.repository == 'mdn/content' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/labeler@v4 | ||
with: | ||
repo-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
# Docs: https://github.com/cbrgm/pr-size-labeler-action | ||
label-by-size: | ||
# do not run on forks | ||
if: github.repository == 'mdn/content' | ||
needs: label-by-path | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Label PR based on size | ||
uses: cbrgm/pr-size-labeler-action@main | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_repository: ${{ github.repository }} # Repository name | ||
github_pr_number: ${{ github.event.number }} # Pull request number | ||
config_file_path: ".github/pull-request-size.yml" # Path to pr-size-labeler config |