Skip to content

Upgrade Issue-Labeler to v2.0.0 #48796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/labeler-build-predictor.yml

This file was deleted.

35 changes: 31 additions & 4 deletions .github/workflows/labeler-cache-retention.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
# 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"

# For more information about GitHub's action cache limits and eviction policy, see:
# https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy

on:
schedule:
- cron: "39 3 * * *" # 3:39 every day (arbitrary time daily, modified to different values in each repository)

workflow_dispatch:
inputs:
cache_key:
description: "The cache key suffix to use for restoring the model from cache. Defaults to 'ACTIVE'."
required: true
default: "ACTIVE"

env:
CACHE_KEY: ${{ inputs.cache_key || 'ACTIVE' }}

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@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
restore-cache:
# Do not automatically run the workflow on forks outside the 'dotnet' org
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type: ["issues", "pulls"]
steps:
- uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
type: ${{ matrix.type }}
cache_key: ${{ env.CACHE_KEY }}
fail-on-cache-miss: true
63 changes: 45 additions & 18 deletions .github/workflows/labeler-predict-issues.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,58 @@
name: "Labeler: Predict Issue Labels"
# 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)"

on:
# Only automatically predict area labels when issues are originally opened
# Only automatically predict area labels when issues are first 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
issues:
description: "Issue Numbers (comma-separated list of ranges)."
required: true
default: "LIVE"
cache_key:
description: "The cache key suffix to use for restoring the model. Defaults to 'ACTIVE'."
required: true
default: "ACTIVE"

env:
# Do not allow failure for jobs triggered automatically (as this causes red noise on the workflows list)
ALLOW_FAILURE: ${{ github.event_name == 'workflow_dispatch' }}

LABEL_PREFIX: "Area-"
THRESHOLD: 0.40

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) }}
predict-issue-label:
# Do not automatically run the workflow on forks outside the 'dotnet' org
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
runs-on: ubuntu-latest
permissions:
issues: write
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 }}
label_prefix: "Area-"
threshold: 0.40
steps:
- name: "Restore issues model from cache"
id: restore-model
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
type: issues
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
quiet: true

- name: "Predict issue labels"
id: prediction
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
issues: ${{ inputs.issues || github.event.issue.number }}
label_prefix: ${{ env.LABEL_PREFIX }}
threshold: ${{ env.THRESHOLD }}
env:
GITHUB_TOKEN: ${{ github.token }}
continue-on-error: ${{ !env.ALLOW_FAILURE }}
65 changes: 47 additions & 18 deletions .github/workflows/labeler-predict-pulls.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
name: "Labeler: Predict Pull Labels"
# 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)"

on:
# Per to the following documentation:
Expand All @@ -13,30 +19,53 @@ on:
# Only automatically predict area labels when pull requests are first opened
pull_request_target:
types: opened

# Configure the branches that need to have PRs labeled
branches:
- 'main'
- 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
pulls:
description: "Pull Request Numbers (comma-separated list of ranges)."
required: true
cache_key:
description: "The cache key suffix to use for restoring the model. Defaults to 'ACTIVE'."
required: true
default: "LIVE"
default: "ACTIVE"

env:
# Do not allow failure for jobs triggered automatically (this can block PR merge)
ALLOW_FAILURE: ${{ github.event_name == 'workflow_dispatch' }}

LABEL_PREFIX: "Area-"
THRESHOLD: 0.40

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) }}
predict-pull-label:
# Do not automatically run the workflow on forks outside the 'dotnet' org
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
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 }}
label_prefix: "Area-"
threshold: 0.40
steps:
- name: "Restore pulls model from cache"
id: restore-model
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
type: pulls
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
quiet: true

- name: "Predict pull labels"
id: prediction
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
pulls: ${{ inputs.pulls || github.event.number }}
label_prefix: ${{ env.LABEL_PREFIX }}
threshold: ${{ env.THRESHOLD }}
env:
GITHUB_TOKEN: ${{ github.token }}
continue-on-error: ${{ !env.ALLOW_FAILURE }}
58 changes: 35 additions & 23 deletions .github/workflows/labeler-promote.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
name: "Labeler: Promote Models"
# 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"

on:
# Dispatched via the Actions UI, promotes the staged models from
# a staging slot into the prediction environment
# a staged slot into the prediction environment
workflow_dispatch:
inputs:
promote_issues:
issues:
description: "Issues: Promote Model"
type: boolean
required: true
promote_pulls:
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
staged_key:
description: "The cache key suffix to use for promoting a staged model to 'ACTIVE'. Defaults to 'staged'."
required: true
default: "staging"
backup_cache_key:
description: "The cache key suffix to use for backing up the currently promoted model"
type: string
default: "staged"
backup_key:
description: "The cache key suffix to use for backing up the currently active model. Defaults to 'backup'."
default: "backup"

permissions:
actions: write

jobs:
labeler-promote-issues:
if: ${{ inputs.promote_issues }}
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 }}
promote-issues:
if: ${{ inputs.issues }}
runs-on: ubuntu-latest
steps:
- name: "Promote Model for Issues"
uses: dotnet/issue-labeler/promote@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
type: "issues"
staged_key: ${{ inputs.staged_key }}
backup_key: ${{ inputs.backup_key }}

labeler-promote-pulls:
if: ${{ inputs.promote_pulls }}
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 }}
promote-pulls:
if: ${{ inputs.pulls }}
runs-on: ubuntu-latest
steps:
- name: "Promote Model for Pull Requests"
uses: dotnet/issue-labeler/promote@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
with:
type: "pulls"
staged_key: ${{ inputs.staged_key }}
backup_key: ${{ inputs.backup_key }}
Loading