Skip to content

Commit 5e05efc

Browse files
authored
DYN-6255 Update issue type predictor workflow (#14884)
1 parent f33a015 commit 5e05efc

File tree

1 file changed

+61
-56
lines changed

1 file changed

+61
-56
lines changed
Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,103 @@
1-
name: Issue Predicter
2-
on:
1+
name: Issue Type Predicter
2+
# This workflow uses https://github.com/DynamoDS/IssuesTypePredicter to predict the type of a github issue
3+
4+
on:
35
issues:
4-
types: [opened,edited]
5-
jobs:
6-
issuePredicterType:
7-
name: Issue Predicter
6+
types: [opened, edited]
7+
8+
jobs:
9+
issue_type_Predicter:
10+
name: Issue Type Predicter
811
runs-on: ubuntu-latest
912
env:
10-
#The 'analysis_response' variable is used to store the script response on step one,
11-
#and then checked on step two to know if adding the label and comment is necessary.
12-
#The initial 'undefined' value will be overridden when the script runs.
13+
# The 'analysis_response' variable is used to store the response returned by issue_analyzer.ps1
14+
# The initial 'undefined' value will be overridden when the script runs
1315
analysis_response: undefined
14-
#The 'parsed_issue_body' variable is used to store the parsed issue body (after removing some sections of the body like Stack Trace)
16+
# The 'parsed_issue_body' variable is used to store the parsed issue body (after removing some sections of the body like Stack Trace)
1517
parsed_issue_body: undefined
16-
#The 'issue_json_string' variable is used to store in a json string (parsed info of the issue body)
18+
# The 'issue_json_string' variable is used to store parsed info of the issue body as a json string
1719
issue_json_string: undefined
18-
#The 'is_wish_list' variable is used to store the value returned by the IssuesTypePredicter project
20+
# The 'is_wish_list' variable is used to store the value returned by the IssuesTypePredicter project
1921
is_wish_list: undefined
20-
#template file name
22+
# issue template file name
2123
template: "ISSUE_TEMPLATE.md"
22-
#amount of sections from the template that can be missing information for the issue to still be considered complete
24+
# amount of sections from the template that can be missing information for the issue to still be considered valid
2325
acceptable_missing_info: 1
26+
2427
steps:
25-
#Removes conflicting characters before using the issue content as a script parameter
26-
- uses: actions/checkout@v4
27-
- name: Remove conflicting chars
28-
env:
29-
ISSUE_BODY: ${{github.event.issue.body}}
28+
# Removes quotes before using the issue content as a script parameter
29+
- name: Remove Quotes
30+
id: remove_quotes
3031
uses: frabert/replace-string-action@v2.4
31-
id: remove_quotations
32+
env:
33+
ISSUE_BODY: ${{ github.event.issue.body }}
3234
with:
3335
pattern: "\""
34-
string: ${{env.ISSUE_BODY}}
36+
string: ${{ env.ISSUE_BODY }}
3537
replace-with: '-'
3638

37-
#Checks for missing information inside the issue content
38-
- name: Check Information
39-
id: check-info
39+
# Analyze for missing information inside the issue content
40+
- name: Analyze Issue Body
4041
env:
41-
ISSUE_BODY: ${{ steps.remove_quotations.outputs.replaced }}
42-
ISSUE_TITLE: ${{ github.event.issue.title }}
42+
ISSUE_BODY: ${{ steps.remove_quotes.outputs.replaced }}
4343
run: |
44-
echo "analysis_response=$(pwsh .\\.github\\scripts\\issue_analyzer.ps1 "${{ env.template }}" "${{ env.acceptable_missing_info }}" )" >> $GITHUB_ENV
45-
46-
#Remove sections in the issue body like "Dynamo version", "Stack Trace" because won't be used to predict the issue type
44+
echo "analysis_response=$(pwsh .\\.github\\scripts\\issue_analyzer.ps1 "${{ env.template }}" "${{ env.acceptable_missing_info }}")" >> $GITHUB_ENV
45+
46+
# Remove sections in the issue body like "Dynamo version", "Stack Trace" because won't be used to predict the issue type
4747
- name: Clean Issue Body
48-
env:
49-
ISSUE_BODY_PARSED: ${{steps.remove_quotations.outputs.replaced}}
5048
if: env.analysis_response == 'Valid'
51-
id: clean-issue-body
49+
env:
50+
ISSUE_BODY_PARSED: ${{ steps.remove_quotes.outputs.replaced }}
5251
run: |
53-
echo "parsed_issue_body="$(pwsh .\\.github\\scripts\\issue_body_cleaner.ps1 )"" >> $GITHUB_ENV
52+
echo "parsed_issue_body="$(pwsh .\\.github\\scripts\\issue_body_cleaner.ps1 )"" >> $GITHUB_ENV
5453
55-
#The IssuesTypePredicter program receives as a parameter a json string with the issue content, then It's creating the json string in this section based in the issue body
54+
# Create json string from the issue body
5655
- name: Create Issue JSON String
57-
env:
58-
ISSUE_NUMBER: ${{github.event.issue.number}}
59-
ISSUE_TITLE: ${{github.event.issue.title}}
6056
if: env.analysis_response == 'Valid'
61-
id: create-issue-json
57+
env:
58+
ISSUE_NUMBER: ${{ github.event.issue.number }}
59+
ISSUE_TITLE: ${{ github.event.issue.title }}
6260
run: |
63-
mkdir IssuesTypePredicter
64-
echo "issue_json_string="$(pwsh .\\.github\\scripts\\get_issue_json_body.ps1 "$ISSUE_NUMBER")"" >> $GITHUB_ENV
61+
echo "issue_json_string="$(pwsh .\\.github\\scripts\\get_issue_json_body.ps1 "$ISSUE_NUMBER")"" >> $GITHUB_ENV
6562
66-
#Now checkout the IssuesTypePredicter source code from the repo https://github.com/DynamoDS/IssuesTypePredicter
63+
# Checkout the IssuesTypePredicter repo (https://github.com/DynamoDS/IssuesTypePredicter)
6764
- name: Checkout IssuesTypePredicter
6865
if: env.analysis_response == 'Valid'
6966
uses: actions/checkout@v4
7067
with:
7168
repository: DynamoDS/IssuesTypePredicter
7269
path: IssuesTypePredicter
7370

74-
#Builds the solution IssuesTypePredicter.sln (this contains two VS2019 ML.NET projects)
75-
- name: Build Issues Type Predicter
71+
- name: Setup dotnet
72+
uses: actions/setup-dotnet@v4
73+
with:
74+
dotnet-version: '3.1.0'
75+
76+
# Build the solution IssuesTypePredicter.sln (this contains two VS2019 ML.NET projects)
77+
- name: Build Issues Type Predicter
7678
if: env.analysis_response == 'Valid'
77-
run: |
79+
run: |
7880
dotnet build ./IssuesTypePredicter/IssuesTypePredicter.sln --configuration Release
7981
cp ./IssuesTypePredicter/IssuesTypePredicterML.ConsoleApp/bin/Release/netcoreapp3.1/MLModel.zip .
80-
81-
#Execute the IssuesTypePredicter program and pass as a parameter the json string (which contains the issue info)
82+
83+
# Execute the IssuesTypePredicter program and pass 'issue_json_string' as a parameter
8284
- name: Run Issues Type Predicter
8385
if: env.analysis_response == 'Valid'
84-
run: |
85-
echo "is_wish_list="$(dotnet run -p ./IssuesTypePredicter/IssuesTypePredicterML.ConsoleApp/IssuesTypePredicterML.ConsoleApp.csproj -v q "${{env.issue_json_string}}")"" >> $GITHUB_ENV
86+
run: |
87+
echo "is_wish_list="$(dotnet run -p ./IssuesTypePredicter/IssuesTypePredicterML.ConsoleApp/IssuesTypePredicterML.ConsoleApp.csproj -v q "${{ env.issue_json_string }}")"" >> $GITHUB_ENV
8688
87-
#If the is_wish_list variable contains 1 means that is a wishlist issue and label the issue with the word "Wishlist"
88-
- name: Label Wishlist
89-
if: contains(env.is_wish_list,'IsWishlist:1') && env.analysis_response == 'Valid'
89+
# If the is_wish_list variable contains 1, label the issue as "Wishlist"
90+
- name: Label issue as 'Wishlist'
91+
if: env.analysis_response == 'Valid' && contains(env.is_wish_list, 'IsWishlist:1')
92+
env:
93+
GH_TOKEN: ${{ secrets.DYNAMO_ISSUES_TOKEN }}
9094
run: |
91-
curl -v -u admin:${{ secrets.DYNAMOBOTTOKEN }} -d '{"labels": ["Wishlist"]}' ${{ github.event.issue.url }}/labels
95+
gh issue edit ${{ github.event.issue.number }} --add-label "Wishlist" --repo ${{ github.repository }}
9296
93-
#When the issue is missing important information (don't follow the template structure) the issue will be labeled as "NotMLEvaluated"
94-
- name: Label NotMLEvaluated
97+
# If the issue is missing important information (don't follow the template structure), label the issue as "NotMLEvaluated"
98+
- name: Label issue as 'NotMLEvaluated'
9599
if: env.analysis_response != 'Valid' || env.issue_json_string == ''
100+
env:
101+
GH_TOKEN: ${{ secrets.DYNAMO_ISSUES_TOKEN }}
96102
run: |
97-
curl -v -u admin:${{ secrets.DYNAMOBOTTOKEN }} -d '{"labels": ["NotMLEvaluated"]}' ${{ github.event.issue.url }}/labels
98-
103+
gh issue edit ${{ github.event.issue.number }} --add-label "NotMLEvaluated" --repo ${{ github.repository }}

0 commit comments

Comments
 (0)