|
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: |
3 | 5 | 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 |
8 | 11 | runs-on: ubuntu-latest
|
9 | 12 | 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 |
13 | 15 | 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) |
15 | 17 | 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 |
17 | 19 | 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 |
19 | 21 | is_wish_list: undefined
|
20 |
| - #template file name |
| 22 | + # issue template file name |
21 | 23 | 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 |
23 | 25 | acceptable_missing_info: 1
|
| 26 | + |
24 | 27 | 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 |
30 | 31 | uses: frabert/replace-string-action@v2.4
|
31 |
| - id: remove_quotations |
| 32 | + env: |
| 33 | + ISSUE_BODY: ${{ github.event.issue.body }} |
32 | 34 | with:
|
33 | 35 | pattern: "\""
|
34 |
| - string: ${{env.ISSUE_BODY}} |
| 36 | + string: ${{ env.ISSUE_BODY }} |
35 | 37 | replace-with: '-'
|
36 | 38 |
|
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 |
40 | 41 | env:
|
41 |
| - ISSUE_BODY: ${{ steps.remove_quotations.outputs.replaced }} |
42 |
| - ISSUE_TITLE: ${{ github.event.issue.title }} |
| 42 | + ISSUE_BODY: ${{ steps.remove_quotes.outputs.replaced }} |
43 | 43 | 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 |
47 | 47 | - name: Clean Issue Body
|
48 |
| - env: |
49 |
| - ISSUE_BODY_PARSED: ${{steps.remove_quotations.outputs.replaced}} |
50 | 48 | if: env.analysis_response == 'Valid'
|
51 |
| - id: clean-issue-body |
| 49 | + env: |
| 50 | + ISSUE_BODY_PARSED: ${{ steps.remove_quotes.outputs.replaced }} |
52 | 51 | 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 |
54 | 53 |
|
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 |
56 | 55 | - name: Create Issue JSON String
|
57 |
| - env: |
58 |
| - ISSUE_NUMBER: ${{github.event.issue.number}} |
59 |
| - ISSUE_TITLE: ${{github.event.issue.title}} |
60 | 56 | 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 }} |
62 | 60 | 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 |
65 | 62 |
|
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) |
67 | 64 | - name: Checkout IssuesTypePredicter
|
68 | 65 | if: env.analysis_response == 'Valid'
|
69 | 66 | uses: actions/checkout@v4
|
70 | 67 | with:
|
71 | 68 | repository: DynamoDS/IssuesTypePredicter
|
72 | 69 | path: IssuesTypePredicter
|
73 | 70 |
|
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 |
76 | 78 | if: env.analysis_response == 'Valid'
|
77 |
| - run: | |
| 79 | + run: | |
78 | 80 | dotnet build ./IssuesTypePredicter/IssuesTypePredicter.sln --configuration Release
|
79 | 81 | 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 |
82 | 84 | - name: Run Issues Type Predicter
|
83 | 85 | 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 |
86 | 88 |
|
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 }} |
90 | 94 | 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 }} |
92 | 96 |
|
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' |
95 | 99 | if: env.analysis_response != 'Valid' || env.issue_json_string == ''
|
| 100 | + env: |
| 101 | + GH_TOKEN: ${{ secrets.DYNAMO_ISSUES_TOKEN }} |
96 | 102 | 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