test2 #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Issue Predicter | |
on: | |
issues: | |
types: [opened,edited] | |
jobs: | |
issuePredicterType: | |
name: Issue Predicter | |
runs-on: ubuntu-latest | |
env: | |
#The 'analysis_response' variable is used to store the script response on step one, | |
#and then checked on step two to know if adding the label and comment is necessary. | |
#The initial 'undefined' value will be overridden when the script runs. | |
analysis_response: undefined | |
#The 'parsed_issue_body' variable is used to store the parsed issue body (after removing some sections of the body like Stack Trace) | |
parsed_issue_body: undefined | |
#The 'issue_json_string' variable is used to store in a json string (parsed info of the issue body) | |
issue_json_string: undefined | |
#The 'is_wish_list' variable is used to store the value returned by the IssuesTypePredicter project | |
is_wish_list: undefined | |
#template file name | |
template: "ISSUE_TEMPLATE.md" | |
#amount of sections from the template that can be missing information for the issue to still be considered complete | |
acceptable_missing_info: 1 | |
steps: | |
#Removes conflicting characters before using the issue content as a script parameter | |
- uses: actions/checkout@v2 | |
- name: Remove conflicting chars | |
env: | |
ISSUE_BODY: ${{github.event.issue.body}} | |
uses: frabert/replace-string-action@v1.2 | |
id: remove_quotations | |
with: | |
pattern: "\"" | |
string: ${{env.ISSUE_BODY}} | |
replace-with: '-' | |
#Checks for missing information inside the issue content | |
- name: Check Information | |
id: check-info | |
env: | |
ISSUE_BODY: ${{ steps.remove_quotations.outputs.replaced }} | |
ISSUE_TITLE: ${{ github.event.issue.title }} | |
run: | | |
echo "analysis_response=$(pwsh .\\.github\\scripts\\issue_analyzer.ps1 "${{ env.template }}" "${{ env.acceptable_missing_info }}" )" >> $GITHUB_ENV | |
#Remove sections in the issue body like "Dynamo version", "Stack Trace" because won't be used to predict the issue type | |
- name: Clean Issue Body | |
env: | |
ISSUE_BODY_PARSED: ${{steps.remove_quotations.outputs.replaced}} | |
if: env.analysis_response == 'Valid' | |
id: clean-issue-body | |
run: | | |
echo "parsed_issue_body="$(pwsh .\\.github\\scripts\\issue_body_cleaner.ps1 )"" >> $GITHUB_ENV | |
#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 | |
- name: Create Issue JSON String | |
env: | |
ISSUE_NUMBER: ${{github.event.issue.number}} | |
ISSUE_TITLE: ${{github.event.issue.title}} | |
if: env.analysis_response == 'Valid' | |
id: create-issue-json | |
run: | | |
mkdir IssuesTypePredicter | |
echo "issue_json_string="$(pwsh .\\.github\\scripts\\get_issue_json_body.ps1 "$ISSUE_NUMBER")"" >> $GITHUB_ENV | |
#Now checkout the IssuesTypePredicter source code from the repo https://github.com/DynamoDS/IssuesTypePredicter | |
- name: Checkout IssuesTypePredicter | |
if: env.analysis_response == 'Valid' | |
uses: actions/checkout@v2 | |
with: | |
repository: RobertGlobant20/IssuesTypePredicter | |
path: IssuesTypePredicter | |
ref: DYN-6651-Updating-NETSDK | |
# Setup dotnet | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0' | |
#Builds the solution IssuesTypePredicter.sln (this contains two VS2019 ML.NET projects) | |
- name: Build Issues Type Predicter | |
if: env.analysis_response == 'Valid' | |
run: | | |
dotnet build ./IssuesTypePredicter/IssuesTypePredicter.sln --configuration Release | |
cp ./IssuesTypePredicter/IssuesTypePredicterML.ConsoleApp/bin/Release/net8.0/MLModel.zip . | |
#Execute the IssuesTypePredicter program and pass as a parameter the json string (which contains the issue info) | |
- name: Run Issues Type Predicter | |
if: env.analysis_response == 'Valid' | |
run: | | |
echo "is_wish_list="$(dotnet run -p ./IssuesTypePredicter/IssuesTypePredicterML.ConsoleApp/IssuesTypePredicterML.ConsoleApp.csproj -v q "${{env.issue_json_string}}")"" >> $GITHUB_ENV | |
#If the is_wish_list variable contains 1 means that is a wishlist issue and label the issue with the word "Wishlist" | |
- name: Label Wishlist | |
if: contains(env.is_wish_list,'IsWishlist:1') && env.analysis_response == 'Valid' | |
run: | | |
curl -v -u admin:${{ secrets.DYNAMOBOTTOKEN }} -d '{"labels": ["Wishlist"]}' ${{ github.event.issue.url }}/labels | |
#When the issue is missing important information (don't follow the template structure) the issue will be labeled as "NotMLEvaluated" | |
- name: Label NotMLEvaluated | |
if: env.analysis_response != 'Valid' || env.issue_json_string == '' | |
run: | | |
curl -v -u admin:${{ secrets.DYNAMOBOTTOKEN }} -d '{"labels": ["NotMLEvaluated"]}' ${{ github.event.issue.url }}/labels | |