8000 Upgrade Issue-Labeler to v2.0.0 (#13405) · dotnet/winforms@b8f4e16 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8f4e16

Browse files
authored
Upgrade Issue-Labeler to v2.0.0 (#13405)
* Import v2.0.0 issue-labeler default workflows * issue-labeler workflow customization for dotnet/winforms
1 parent dafb8c0 commit b8f4e16

File tree

7 files changed

+342
-129
lines changed

7 files changed

+342
-129
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: "25 20 * * *" # 20:25 every day (arbitrary time daily)
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: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,60 @@
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
31+
DEFAULT_LABEL: "needs-area-label"
1932

2033
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) }}
34+
predict-issue-label:
35+
# Do not automatically run the workflow on forks outside the 'dotnet' org
36+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
37+
runs-on: ubuntu-latest
2438
permissions:
2539
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
32-
default_label: "needs-area-label"
40+
steps:
41+
- name: "Restore issues model from cache"
42+
id: restore-model
43+
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
44+
with:
45+
type: issues
46+
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
47+
quiet: true
48+
49+
- name: "Predict issue labels"
50+
id: prediction
51+
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
52+
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
53+
with:
54+
issues: ${{ inputs.issues || github.event.issue.number }}
55+
label_prefix: ${{ env.LABEL_PREFIX }}
56+
threshold: ${{ env.THRESHOLD }}
57+
default_label: ${{ env.DEFAULT_LABEL }}
58+
env:
59+
GITHUB_TOKEN: ${{ github.token }}
60+
continue-on-error: ${{ !env.ALLOW_FAILURE }}
Lines changed: 48 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,32 +19,56 @@ 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:
1725
- 'main'
1826
- 'release/**'
1927

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

3247
jobs:
33-
predict-pulls:
34-
# Do not run the workflow on forks outside the 'dotnet' org
35-
if: ${{ github.repository_owner == 'dotnet' && (inputs.pull_numbers || github.event.number) }}
48+
predict-pull-label:
49+
# Do not automatically run the workflow on forks outside the 'dotnet' org
50+
if: ${{ github.event_name == 'workflow_dispatch' || github.repository_owner == 'dotnet' }}
51+
runs-on: ubuntu-latest
3652
permissions:
3753
pull-requests: write
38-
uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@f0c098669828a134c0313adf3f58c1909e555d86 # v1.0.1
39-
with:
40-
model_cache_key: ${{ inputs.model_cache_key }}
41-
pull_numbers: ${{ inputs.pull_numbers || github.event.number }}
42-
label_prefix: "area-"
43-
threshold: 0.40
44-
default_label: "needs-area-label"
54+
steps:
55+
- name: "Restore pulls model from cache"
56+
id: restore-model
57+
uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
58+
with:
59+
type: pulls
60+
fail-on-cache-miss: ${{ env.ALLOW_FAILURE }}
61+
quiet: true
62+
63+
- name: "Predict pull labels"
64+
id: prediction
65+
if: ${{ steps.restore-model.outputs.cache-hit == 'true' }}
66+
uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
67+
with:
68+
pulls: ${{ inputs.pulls || github.event.number }}
69+
label_prefix: ${{ env.LABEL_PREFIX }}
70+
threshold: ${{ env.THRESHOLD }}
71+
default_label: ${{ env.DEFAULT_LABEL }}
72+
env:
73+
GITHUB_TOKEN: ${{ github.token }}
74+
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)
0