From 914326c6283bac9bed29ec020eafba1c80f270a6 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Tue, 6 May 2025 12:13:46 -0700 Subject: [PATCH] Refine the issue-labeler config for this repo. Add comments and a doc. --- .github/workflows/labeler-cache-retention.yml | 5 +++ .github/workflows/labeler-predict-issues.yml | 7 ++-- .github/workflows/labeler-predict-pulls.yml | 7 ++-- .github/workflows/labeler-promote.yml | 5 +++ .github/workflows/labeler-train.yml | 15 ++++++--- .github/workflows/labeler.md | 32 +++++++++++++++++++ 6 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/labeler.md diff --git a/.github/workflows/labeler-cache-retention.yml b/.github/workflows/labeler-cache-retention.yml index b9f0ad1a05e..7f78390c0cf 100644 --- a/.github/workflows/labeler-cache-retention.yml +++ b/.github/workflows/labeler-cache-retention.yml @@ -1,3 +1,8 @@ +# Workflow template imported and updated from: +# https://github.com/dotnet/issue-labeler/wiki/Onboarding +# +# See labeler.md for more information +# # Regularly restore the prediction models from cache to prevent cache eviction name: "Labeler: Cache Retention" diff --git a/.github/workflows/labeler-predict-issues.yml b/.github/workflows/labeler-predict-issues.yml index e2447a37c7b..a12efc1512a 100644 --- a/.github/workflows/labeler-predict-issues.yml +++ b/.github/workflows/labeler-predict-issues.yml @@ -1,3 +1,8 @@ +# Workflow template imported and updated from: +# https://github.com/dotnet/issue-labeler/wiki/Onboarding +# +# See labeler.md for more information +# # Predict labels for Issues using a trained model name: "Labeler: Predict (Issues)" @@ -24,7 +29,6 @@ env: LABEL_PREFIX: "area-" THRESHOLD: 0.40 DEFAULT_LABEL: "needs-area-label" - EXCLUDED_AUTHORS: "" # Comma-separated list of authors to exclude from training data jobs: predict-issue-label: @@ -51,7 +55,6 @@ jobs: label_prefix: ${{ env.LABEL_PREFIX }} threshold: ${{ env.THRESHOLD }} default_label: ${{ env.DEFAULT_LABEL }} - excluded_authors: ${{ env.EXCLUDED_AUTHORS }} env: GITHUB_TOKEN: ${{ github.token }} continue-on-error: ${{ !env.ALLOW_FAILURE }} diff --git a/.github/workflows/labeler-predict-pulls.yml b/.github/workflows/labeler-predict-pulls.yml index fca558fa18e..7a89fa03f67 100644 --- a/.github/workflows/labeler-predict-pulls.yml +++ b/.github/workflows/labeler-predict-pulls.yml @@ -1,3 +1,8 @@ +# Workflow template imported and updated from: +# https://github.com/dotnet/issue-labeler/wiki/Onboarding +# +# See labeler.md for more information +# # Predict labels for Pull Requests using a trained model name: "Labeler: Predict (Pulls)" @@ -37,7 +42,6 @@ env: LABEL_PREFIX: "area-" THRESHOLD: 0.40 DEFAULT_LABEL: "needs-area-label" - EXCLUDED_AUTHORS: "" # Comma-separated list of authors to exclude from training data jobs: predict-pull-label: @@ -64,7 +68,6 @@ jobs: label_prefix: ${{ env.LABEL_PREFIX }} threshold: ${{ env.THRESHOLD }} default_label: ${{ env.DEFAULT_LABEL }} - excluded_authors: ${{ env.EXCLUDED_AUTHORS }} env: GITHUB_TOKEN: ${{ github.token }} continue-on-error: ${{ !env.ALLOW_FAILURE }} diff --git a/.github/workflows/labeler-promote.yml b/.github/workflows/labeler-promote.yml index f5208c5191f..c01086c5177 100644 --- a/.github/workflows/labeler-promote.yml +++ b/.github/workflows/labeler-promote.yml @@ -1,3 +1,8 @@ +# Workflow template imported and updated from: +# https://github.com/dotnet/issue-labeler/wiki/Onboarding +# +# See labeler.md for more information +# # Promote a model from staging to 'ACTIVE', backing up the currently 'ACTIVE' model name: "Labeler: Promotion" diff --git a/.github/workflows/labeler-train.yml b/.github/workflows/labeler-train.yml index b3fd6dad2ca..397ef174142 100644 --- a/.github/workflows/labeler-train.yml +++ b/.github/workflows/labeler-train.yml @@ -1,3 +1,8 @@ +# Workflow template imported and updated from: +# https://github.com/dotnet/issue-labeler/wiki/Onboarding +# +# See labeler.md for more information +# # Train the Issues and Pull Requests models for label prediction name: "Labeler: Training" @@ -29,7 +34,7 @@ on: description: "Max number of items to download for training/testing the model (newest items are used). Defaults to the max number of pages times the page size." type: number page_size: - description: "Number of items per page in GitHub API requests. Defaults to 100 for issues, 25 for pull requests." + description: "Number of items per page in GitHub API requests. Defaults to 100 for issues. Always uses 1 for pull requests." type: number page_limit: description: "Maximum number of pages to download for training/testing the model. Defaults to 1000 for issues, 4000 for pull requests." @@ -84,8 +89,8 @@ jobs: repository: ${{ env.REPOSITORY }} label_prefix: ${{ env.LABEL_PREFIX }} limit: ${{ env.LIMIT }} - page_size: ${{ env.PAGE_SIZE }} - page_limit: ${{ env.PAGE_LIMIT }} + page_size: 1 # This repository can only successfully download pulls one at a time due to GitHub's API performance + page_limit: 10000 # Download the newest 10,000 pull requests excluded_authors: ${{ env.EXCLUDED_AUTHORS }} env: GITHUB_TOKEN: ${{ github.token }} @@ -154,8 +159,8 @@ jobs: label_prefix: ${{ env.LABEL_PREFIX }} threshold: ${{ env.THRESHOLD }} limit: ${{ env.LIMIT }} - page_size: ${{ env.PAGE_SIZE }} - page_limit: ${{ env.PAGE_LIMIT }} + page_size: 1 # This repository can only successfully download pulls one at a time due to GitHub's API performance + page_limit: 10000 # Download the newest 10,000 pull requests excluded_authors: ${{ env.EXCLUDED_AUTHORS }} env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/labeler.md b/.github/workflows/labeler.md new file mode 100644 index 00000000000..68281bfa659 --- /dev/null +++ b/.github/workflows/labeler.md @@ -0,0 +1,32 @@ +# Issue-Labeler Workflows + +This repository uses actions from [dotnet/issue-labeler](https://github.com/dotnet/issue-labeler) to predict area labels for issues and pull requests. + +The following workflow templates were imported and updated from [dotnet/issue-labeler/wiki/Onboarding](https://github.com/dotnet/issue-labeler/wiki/Onboarding): + +1. `labeler-cache-retention.yml` +2. `labeler-predict-issues.yml` +3. `labeler-predict-pulls.yml` +4. `labeler-promote.yml` +5. `labeler-train.yml` + +## Repository Configuration + +Across these workflows, the following changes were made to configure the issue labeler for this repository: + +1. Set `LABEL_PREFIX` to `"area-"`: + - `labeler-predict-issues.yml` + - `labeler-predict-pulls.yml` + - `labeler-train.yml` +2. Set `DEFAULT_LABEL` to `"needs-area-label"`: + - `labeler-predict-issues.yml` + - `labeler-predict-pulls.yml` +3. Remove the `EXCLUDED_AUTHORS` value as we do not bypass labeling for any authors' issues/pulls in this repository: + - `labeler-predict-issues.yml` + - `labeler-predict-pulls.yml` +4. Remove the `repository` input for training the models against another repository: + - `labeler-train.yml` +5. Hard-code the `page_size` to 1 and `page_limit` to 10000 for pull requests + - `labeler-train.yml` (on both the `download-pulls` and `test-pulls` jobs) +6. Update the cache retention cron schedule to an arbitrary time of day: + - `labeler-cache-retention.yml`