From 7ae558d6e2cf6b886fdbe95f373fe436936e4e0b Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Thu, 6 Mar 2025 23:53:45 -0800 Subject: [PATCH 1/2] Onboard to the GitHub workflow based issue-labeler --- .github/workflows/labeler-build-predictor.yml | 17 ++++++ .github/workflows/labeler-cache-retention.yml | 13 ++++ .github/workflows/labeler-predict-issues.yml | 32 ++++++++++ .github/workflows/labeler-predict-pulls.yml | 43 +++++++++++++ .github/workflows/labeler-promote.yml | 42 +++++++++++++ .github/workflows/labeler-train.yml | 60 +++++++++++++++++++ 6 files changed, 207 insertions(+) create mode 100644 .github/workflows/labeler-build-predictor.yml create mode 100644 .github/workflows/labeler-cache-retention.yml create mode 100644 .github/workflows/labeler-predict-issues.yml create mode 100644 .github/workflows/labeler-predict-pulls.yml create mode 100644 .github/workflows/labeler-promote.yml create mode 100644 .github/workflows/labeler-train.yml diff --git a/.github/workflows/labeler-build-predictor.yml b/.github/workflows/labeler-build-predictor.yml new file mode 100644 index 00000000000..59c8a3574d3 --- /dev/null +++ b/.github/workflows/labeler-build-predictor.yml @@ -0,0 +1,17 @@ +name: "Labeler: Build Predictor App" + +on: + # Allow dispatching the workflow via the Actions UI + workflow_dispatch: + inputs: + rebuild: + description: "Force a rebuild of the app" + type: boolean + +jobs: + build-predictor: + permissions: + actions: write + uses: dotnet/issue-labeler/.github/workflows/build-predictor.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + rebuild: ${{ inputs.rebuild }} diff --git a/.github/workflows/labeler-cache-retention.yml b/.github/workflows/labeler-cache-retention.yml new file mode 100644 index 00000000000..8a6578dcbca --- /dev/null +++ b/.github/workflows/labeler-cache-retention.yml @@ -0,0 +1,13 @@ +name: "Labeler: Cache Retention" + +on: + schedule: + - cron: "13 6 * * *" # 6:13 every day (arbitrary time daily) + + workflow_dispatch: + +jobs: + cache-retention: + # Do not run the workflow on forks outside the 'dotnet' org + if: ${{ github.repository_owner == 'dotnet' }} + uses: dotnet/issue-labeler/.github/workflows/cache-retention.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 diff --git a/.github/workflows/labeler-predict-issues.yml b/.github/workflows/labeler-predict-issues.yml new file mode 100644 index 00000000000..c41be9f6c15 --- /dev/null +++ b/.github/workflows/labeler-predict-issues.yml @@ -0,0 +1,32 @@ +name: "Labeler: Predict Issue Labels" + +on: + # Only automatically predict area labels when issues are originally opened + issues: + types: opened + + # Allow dispatching the workflow via the Actions UI, specifying ranges of numbers + workflow_dispatch: + inputs: + issue_numbers: + description: "Issue Numbers (comma-separated list of ranges)" + type: string + model_cache_key: + description: "The cache key suffix to use for loading the model" + type: string + required: true + default: "LIVE" + +jobs: + predict-issues: + # Do not run the workflow on forks outside the 'dotnet' org + if: ${{ github.repository_owner == 'dotnet' && (inputs.issue_numbers || github.event.issue.number) }} + permissions: + issues: write + uses: dotnet/issue-labeler/.github/workflows/predict-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + model_cache_key: ${{ inputs.model_cache_key }} + issue_numbers: ${{ inputs.issue_numbers || github.event.issue.number }} + label_prefix: "area-" + threshold: 0.40 + default_label: "needs-area-label" diff --git a/.github/workflows/labeler-predict-pulls.yml b/.github/workflows/labeler-predict-pulls.yml new file mode 100644 index 00000000000..684692cf6e8 --- /dev/null +++ b/.github/workflows/labeler-predict-pulls.yml @@ -0,0 +1,43 @@ +name: "Labeler: Predict Pull Labels" + +on: + # Per to the following documentation: + # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target + # + # The `pull_request_target` event runs in the context of the base of the pull request, rather + # than in the context of the merge commit, as the `pull_request` event does. This prevents + # execution of unsafe code from the head of the pull request that could alter the repository + # or steal any secrets you use in your workflow. This event allows your workflow to do things + # like label or comment on pull requests from forks. + # + # Only automatically predict area labels when pull requests are first opened + pull_request_target: + types: opened + branches: + - 'main' + + # Allow dispatching the workflow via the Actions UI, specifying ranges of numbers + workflow_dispatch: + inputs: + pull_numbers: + description: "Pull Numbers (comma-separated list of ranges)" + type: string + model_cache_key: + description: "The cache key suffix to use for loading the model" + type: string + required: true + default: "LIVE" + +jobs: + predict-pulls: + # Do not run the workflow on forks outside the 'dotnet' org + if: ${{ github.repository_owner == 'dotnet' && (inputs.pull_numbers || github.event.number) }} + permissions: + pull-requests: write + uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + model_cache_key: ${{ inputs.model_cache_key }} + pull_numbers: ${{ inputs.pull_numbers || github.event.number }} + label_prefix: "area-" + threshold: 0.40 + default_label: "needs-area-label" diff --git a/.github/workflows/labeler-promote.yml b/.github/workflows/labeler-promote.yml new file mode 100644 index 00000000000..ddbc554cc95 --- /dev/null +++ b/.github/workflows/labeler-promote.yml @@ -0,0 +1,42 @@ +name: "Labeler: Promote Models" + +on: + # Dispatched via the Actions UI, promotes the staged models from + # a staging slot into the prediction environment + workflow_dispatch: + inputs: + promote_issues: + description: "Issues: Promote Model" + type: boolean + required: true + promote_pulls: + description: "Pulls: Promote Model" + type: boolean + required: true + model_cache_key: + description: "The cache key suffix to promote into the 'LIVE' cache" + type: string + required: true + default: "staging" + backup_cache_key: + description: "The cache key suffix to use for backing up the currently promoted model" + type: string + default: "backup" + +permissions: + actions: write + +jobs: + labeler-promote-issues: + if: ${{ inputs.promote_issues }} + uses: dotnet/issue-labeler/.github/workflows/promote-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + model_cache_key: ${{ inputs.model_cache_key }} + backup_cache_key: ${{ inputs.backup_cache_key }} + + labeler-promote-pulls: + if: ${{ inputs.promote_pulls }} + uses: dotnet/issue-labeler/.github/workflows/promote-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + model_cache_key: ${{ inputs.model_cache_key }} + backup_cache_key: ${{ inputs.backup_cache_key }} diff --git a/.github/workflows/labeler-train.yml b/.github/workflows/labeler-train.yml new file mode 100644 index 00000000000..72f38fc4da3 --- /dev/null +++ b/.github/workflows/labeler-train.yml @@ -0,0 +1,60 @@ +name: "Labeler: Train Models" + +on: + # Dispatched via the Actions UI, stages new models for promotion consideration + # Each step of the workflow can be run independently: Download, Train, and Test + workflow_dispatch: + inputs: + download_issues: + description: "Issues: Download Data" + type: boolean + default: true + train_issues: + description: "Issues: Train Model" + type: boolean + default: true + test_issues: + description: "Issues: Test Model" + type: boolean + default: true + download_pulls: + description: "Pulls: Download Data" + type: boolean + default: true + train_pulls: + description: "Pulls: Train Model" + type: boolean + default: true + test_pulls: + description: "Pulls: Test Model" + type: boolean + default: true + + data_limit: + description: "Max number of items to include in the model" + type: number + + cache_key_suffix: + description: "The cache key suffix to use for staging data/models (use 'LIVE' to bypass staging)" + type: string + required: true + default: "staging" + +jobs: + labeler-train: + permissions: + issues: read + pull-requests: read + actions: write + uses: dotnet/issue-labeler/.github/workflows/train.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + with: + download_issues: ${{ inputs.download_issues }} + train_issues: ${{ inputs.train_issues }} + test_issues: ${{ inputs.test_issues }} + download_pulls: ${{ inputs.download_pulls }} + train_pulls: ${{ inputs.train_pulls }} + test_pulls: ${{ inputs.test_pulls }} + data_limit: ${{ inputs.data_limit && fromJSON(inputs.data_limit) || 0 }} + cache_key_suffix: ${{ inputs.cache_key_suffix }} + label_prefix: "area-" + threshold: 0.40 From 1ef8476e97854395cae38f0c778b56779eb46979 Mon Sep 17 00:00:00 2001 From: Jeff Handley Date: Fri, 7 Mar 2025 04:18:14 -0800 Subject: [PATCH 2/2] Bump to issue-labeler v1.0.1 --- .github/workflows/labeler-build-predictor.yml | 2 +- .github/workflows/labeler-cache-retention.yml | 2 +- .github/workflows/labeler-predict-issues.yml | 2 +- .github/workflows/labeler-predict-pulls.yml | 2 +- .github/workflows/labeler-promote.yml | 4 ++-- .github/workflows/labeler-train.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/labeler-build-predictor.yml b/.github/workflows/labeler-build-predictor.yml index 59c8a3574d3..8a12b312db0 100644 --- a/.github/workflows/labeler-build-predictor.yml +++ b/.github/workflows/labeler-build-predictor.yml @@ -12,6 +12,6 @@ jobs: build-predictor: permissions: actions: write - uses: dotnet/issue-labeler/.github/workflows/build-predictor.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/build-predictor.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: rebuild: ${{ inputs.rebuild }} diff --git a/.github/workflows/labeler-cache-retention.yml b/.github/workflows/labeler-cache-retention.yml index 8a6578dcbca..c6914710cac 100644 --- a/.github/workflows/labeler-cache-retention.yml +++ b/.github/workflows/labeler-cache-retention.yml @@ -10,4 +10,4 @@ jobs: cache-retention: # Do not run the workflow on forks outside the 'dotnet' org if: ${{ github.repository_owner == 'dotnet' }} - uses: dotnet/issue-labeler/.github/workflows/cache-retention.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/cache-retention.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 diff --git a/.github/workflows/labeler-predict-issues.yml b/.github/workflows/labeler-predict-issues.yml index c41be9f6c15..f1783e7340c 100644 --- a/.github/workflows/labeler-predict-issues.yml +++ b/.github/workflows/labeler-predict-issues.yml @@ -23,7 +23,7 @@ jobs: if: ${{ github.repository_owner == 'dotnet' && (inputs.issue_numbers || github.event.issue.number) }} permissions: issues: write - uses: dotnet/issue-labeler/.github/workflows/predict-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/predict-issues.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: model_cache_key: ${{ inputs.model_cache_key }} issue_numbers: ${{ inputs.issue_numbers || github.event.issue.number }} diff --git a/.github/workflows/labeler-predict-pulls.yml b/.github/workflows/labeler-predict-pulls.yml index 684692cf6e8..4f00854d5df 100644 --- a/.github/workflows/labeler-predict-pulls.yml +++ b/.github/workflows/labeler-predict-pulls.yml @@ -34,7 +34,7 @@ jobs: if: ${{ github.repository_owner == 'dotnet' && (inputs.pull_numbers || github.event.number) }} permissions: pull-requests: write - uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: model_cache_key: ${{ inputs.model_cache_key }} pull_numbers: ${{ inputs.pull_numbers || github.event.number }} diff --git a/.github/workflows/labeler-promote.yml b/.github/workflows/labeler-promote.yml index ddbc554cc95..97f40afa8f1 100644 --- a/.github/workflows/labeler-promote.yml +++ b/.github/workflows/labeler-promote.yml @@ -29,14 +29,14 @@ permissions: jobs: labeler-promote-issues: if: ${{ inputs.promote_issues }} - uses: dotnet/issue-labeler/.github/workflows/promote-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/promote-issues.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: model_cache_key: ${{ inputs.model_cache_key }} backup_cache_key: ${{ inputs.backup_cache_key }} labeler-promote-pulls: if: ${{ inputs.promote_pulls }} - uses: dotnet/issue-labeler/.github/workflows/promote-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/promote-pulls.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: model_cache_key: ${{ inputs.model_cache_key }} backup_cache_key: ${{ inputs.backup_cache_key }} diff --git a/.github/workflows/labeler-train.yml b/.github/workflows/labeler-train.yml index 72f38fc4da3..9775be4fe00 100644 --- a/.github/workflows/labeler-train.yml +++ b/.github/workflows/labeler-train.yml @@ -46,7 +46,7 @@ jobs: issues: read pull-requests: read actions: write - uses: dotnet/issue-labeler/.github/workflows/train.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0 + uses: dotnet/issue-labeler/.github/workflows/train.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1 with: download_issues: ${{ inputs.download_issues }} train_issues: ${{ inputs.train_issues }}