Skip to content

Commit b0c5ab4

Browse files
authored
Upgrade Issue-Labeler to v2.0.0 (#48796)
1 parent 5457ad3 commit b0c5ab4

7 files changed

+337
-128
lines changed

.github/workflows/labeler-build-predictor.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
1+
# Workflow template imported and updated from:
2+
# https://github.com/dotnet/issue-labeler/wiki/Onboarding
3+
#
4+
# See labeler.md for more information
5+
#
6+
# Regularly restore the prediction models from cache to prevent cache eviction
17
name: "Labeler: Cache Retention"
28

9+
# For more information about GitHub's action cache limits and eviction policy, see:
10+
# https://docs.github.com/actions/writing-workflows/choosing-what-your-workflow-does/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy
11+
312
on:
413
schedule:
514
- cron: "39 3 * * *" # 3:39 every day (arbitrary time daily, modified to different values in each repository)
615

716
workflow_dispatch:
17+
inputs:
18+
cache_key:
19+
description: "The cache key suffix to use for restoring the model from cache. Defaults to 'ACTIVE'."
20+
required: true
21+
default: "ACTIVE"
22+
23+
env:
24+
CACHE_KEY: ${{ inputs.cache_key || 'ACTIVE' }}
825

926
jobs:
10-
cache-retention:
11-
# Do not run the workflow on forks outside the 'dotnet' org
12-
if: ${{ github.repository_owner == 'dotnet' }}
13-
uses: dotnet/issue-labeler/.github/workflows/cache-retention.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
27+
restore-cache:
28+
# Do not automatically run the workflow on forks outside the 'dotnet' org
29+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
30+
runs-on: ubuntu-latest
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
type: ["issues", "pulls"]
35+
steps:
36+
- uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
37+
with:
38+
type: ${{ matrix.type }}
39+
cache_key: ${{ env.CACHE_KEY }}
40+
fail-on-cache-miss: true
Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,58 @@
1-
name: "Labeler: Predict Issue Labels"
1+
# Workflow template imported and updated from:
2+
# https://github.com/dotnet/issue-labeler/wiki/Onboarding
3+
#
4+
# See labeler.md for more information
5+
#
6+
# Predict labels for Issues using a trained model
7+
name: "Labeler: Predict (Issues)"
28

39
on:
4-
# Only automatically predict area labels when issues are originally opened
10+
# Only automatically predict area labels when issues are first opened
511
issues:
612
types: opened
713

814
# Allow dispatching the workflow via the Actions UI, specifying ranges of numbers
915
workflow_dispatch:
1016
inputs:
11-
issue_numbers:
12-
description: "Issue Numbers (comma-separated list of ranges)"
13-
type: string
14-
model_cache_key:
15-
description: "The cache key suffix to use for loading the model"
16-
type: string
17+
issues:
18+
description: "Issue Numbers (comma-separated list of ranges)."
1719
required: true
18-
default: "LIVE"
20+
cache_key:
21+
description: "The cache key suffix to use for restoring the model. Defaults to 'ACTIVE'."
22+
required: true
23+
default: "ACTIVE"
24+
25+
env:
26+
# Do not allow failure for jobs triggered automatically (as this causes red noise on the workflows list)
27+
ALLOW_FAILURE: ${{ github.event_name == 'workflow_dispatch' }}
28+
29+
LABEL_PREFIX: "Area-"
30+
THRESHOLD: 0.40
1931

2032
jobs:
21-
predict-issues:
22-
# Do not run the workflow on forks outside the 'dotnet' org
23-
if: ${{ github.repository_owner == 'dotnet' && (inputs.issue_numbers || github.event.issue.number) }}
33+
predict-issue-label:
34+
# Do not automatically run the workflow on forks outside the 'dotnet' org
35+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
36+
runs-on: ubuntu-latest
2437
permissions:
2538
issues: write
26-
uses: dotnet/issue-labeler/.github/workflows/predict-issues.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
27-
with:
28-
model_cache_key: ${{ inputs.model_cache_key }}
29-
issue_numbers: ${{ inputs.issue_numbers || github.event.issue.number }}
30-
label_prefix: "Area-"
31-
threshold: 0.40
39+
steps:
40+
- name: "Restore issues model from cache"
41+
id: restore-model
42+
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
43+
with:
44+
type: issues
45+
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
46+
quiet: true
47+
48+
- name: "Predict issue labels"
49+
id: prediction
50+
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
51+
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
52+
with:
53+
issues: ${{ inputs.issues || github.event.issue.number }}
54+
label_prefix: ${{ env.LABEL_PREFIX }}
55+
threshold: ${{ env.THRESHOLD }}
56+
env:
57+
GITHUB_TOKEN: ${{ github.token }}
58+
continue-on-error: ${{ !env.ALLOW_FAILURE }}
Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
name: "Labeler: Predict Pull Labels"
1+
# Workflow template imported and updated from:
2+
# https://github.com/dotnet/issue-labeler/wiki/Onboarding
3+
#
4+
# See labeler.md for more information
5+
#
6+
# Predict labels for Pull Requests using a trained model
7+
name: "Labeler: Predict (Pulls)"
28

39
on:
410
# Per to the following documentation:
@@ -13,30 +19,53 @@ on:
1319
# Only automatically predict area labels when pull requests are first opened
1420
pull_request_target:
1521
types: opened
22+
23+
# Configure the branches that need to have PRs labeled
1624
branches:
17-
- 'main'
25+
- main
1826

1927
# Allow dispatching the workflow via the Actions UI, specifying ranges of numbers
2028
workflow_dispatch:
2129
inputs:
22-
pull_numbers:
23-
description: "Pull Numbers (comma-separated list of ranges)"
24-
type: string
25-
model_cache_key:
26-
description: "The cache key suffix to use for loading the model"
27-
type: string
30+
pulls:
31+
description: "Pull Request Numbers (comma-separated list of ranges)."
32+
required: true
33+
cache_key:
34+
description: "The cache key suffix to use for restoring the model. Defaults to 'ACTIVE'."
2835
required: true
29-
default: "LIVE"
36+
default: "ACTIVE"
37+
38+
env:
39+
# Do not allow failure for jobs triggered automatically (this can block PR merge)
40+
ALLOW_FAILURE: ${{ github.event_name == 'workflow_dispatch' }}
41+
42+
LABEL_PREFIX: "Area-"
43+
THRESHOLD: 0.40
3044

3145
jobs:
32-
predict-pulls:
33-
# Do not run the workflow on forks outside the 'dotnet' org
34-
if: ${{ github.repository_owner == 'dotnet' && (inputs.pull_numbers || github.event.number) }}
46+
predict-pull-label:
47+
# Do not automatically run the workflow on forks outside the 'dotnet' org
48+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
49+
runs-on: ubuntu-latest
3550
permissions:
3651
pull-requests: write
37-
uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
38-
with:
39-
model_cache_key: ${{ inputs.model_cache_key }}
40-
pull_numbers: ${{ inputs.pull_numbers || github.event.number }}
41-
label_prefix: "Area-"
42-
threshold: 0.40
52+
steps:
53+
- name: "Restore pulls model from cache"
54+
id: restore-model
55+
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
56+
with:
57+
type: pulls
58+
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
59+
quiet: true
60+
61+
- name: "Predict pull labels"
62+
id: prediction
63+
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
64+
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
65+
with:
66+
pulls: ${{ inputs.pulls || github.event.number }}
67+
label_prefix: ${{ env.LABEL_PREFIX }}
68+
threshold: ${{ env.THRESHOLD }}
69+
env:
70+
GITHUB_TOKEN: ${{ github.token }}
71+
continue-on-error: ${{ !env.ALLOW_FAILURE }}

.github/workflows/labeler-promote.yml

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,54 @@
1-
name: "Labeler: Promote Models"
1+
# Workflow template imported and updated from:
2+
# https://github.com/dotnet/issue-labeler/wiki/Onboarding
3+
#
4+
# See labeler.md for more information
5+
#
6+
# Promote a model from staging to 'ACTIVE', backing up the currently 'ACTIVE' model
7+
name: "Labeler: Promotion"
28

39
on:
410
# Dispatched via the Actions UI, promotes the staged models from
5-
# a staging slot into the prediction environment
11+
# a staged slot into the prediction environment
612
workflow_dispatch:
713
inputs:
8-
promote_issues:
14+
issues:
915
description: "Issues: Promote Model"
1016
type: boolean
1117
required: true
12-
promote_pulls:
18+
pulls:
1319
description: "Pulls: Promote Model"
1420
type: boolean
1521
required: true
16-
model_cache_key:
17-
description: "The cache key suffix to promote into the 'LIVE' cache"
18-
type: string
22+
staged_key:
23+
description: "The cache key suffix to use for promoting a staged model to 'ACTIVE'. Defaults to 'staged'."
1924
required: true
20-
default: "staging"
21-
backup_cache_key:
22-
description: "The cache key suffix to use for backing up the currently promoted model"
23-
type: string
25+
default: "staged"
26+
backup_key:
27+
description: "The cache key suffix to use for backing up the currently active model. Defaults to 'backup'."
2428
default: "backup"
2529

2630
permissions:
2731
actions: write
2832

2933
jobs:
30-
labeler-promote-issues:
31-
if: ${{ inputs.promote_issues }}
32-
uses: dotnet/issue-labeler/.github/workflows/promote-issues.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
33-
with:
34-
model_cache_key: ${{ inputs.model_cache_key }}
35-
backup_cache_key: ${{ inputs.backup_cache_key }}
34+
promote-issues:
35+
if: ${{ inputs.issues }}
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: "Promote Model for Issues"
39+
uses: dotnet/issue-labeler/promote@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
40+
with:
41+
type: "issues"
42+
staged_key: ${{ inputs.staged_key }}
43+
backup_key: ${{ inputs.backup_key }}
3644

37-
labeler-promote-pulls:
38-
if: ${{ inputs.promote_pulls }}
39-
uses: dotnet/issue-labeler/.github/workflows/promote-pulls.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
40-
with:
41-
model_cache_key: ${{ inputs.model_cache_key }}
42-
backup_cache_key: ${{ inputs.backup_cache_key }}
45+
promote-pulls:
46+
if: ${{ inputs.pulls }}
47+
runs-on: ubuntu-latest
48+
steps:
49+
- name: "Promote Model for Pull Requests"
50+
uses: dotnet/issue-labeler/promote@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
51+
with:
52+
type: "pulls"
53+
staged_key: ${{ inputs.staged_key }}
54+
backup_key: ${{ inputs.backup_key }}

0 commit comments

Comments
 (0)