From 676a8c9f2beea45528760616fef75bfaacccb12e Mon Sep 17 00:00:00 2001 From: Blue Date: Fri, 3 May 2024 20:30:55 +0000 Subject: [PATCH] Add logic to process new logs when an issue is edited (#11544) * Add logic to review edited issues if log files were added * Add workflow * yaml * yaml * yaml * yaml * yaml --- .github/actions/triage/action.yml | 16 ++++++++++-- .github/workflows/issue_edited.yml | 40 ++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/issue_edited.yml diff --git a/.github/actions/triage/action.yml b/.github/actions/triage/action.yml index 300ce86..31637a1 100644 --- a/.github/actions/triage/action.yml +++ b/.github/actions/triage/action.yml @@ -14,6 +14,9 @@ inputs: token: required: false type: string + previous_body: + required: false + type: string runs: using: "composite" @@ -21,6 +24,8 @@ runs: - name: 'Run WTI' if: ${{ !contains(inputs.similar_issues_text, '''@') }} # Skip this step if the description contains a string that will break the here document shell: pwsh + env: + previous_body: "${{ inputs.previous_body }}" run: | $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop $message = @' @@ -39,6 +44,13 @@ runs: $maybe_comment = @("--comment", "${{ inputs.comment }}") } - curl.exe -L https://github.com/OneBlue/wti/releases/download/v0.1.7/wti.exe -o triage/wti.exe + $maybe_previous_body = @() + if (![string]::IsNullOrEmpty("$env:previous_body")) + { + $env:previous_body | Out-File -Encoding utf8 "triage\previous_body.txt" + $maybe_previous_body = @("--previous-issue-body", "previous_body.txt") + } - cd triage && echo -n $message | .\wti.exe --issue ${{ inputs.issue }} --config config.yml --github-token "${{ inputs.token }}" --ignore-tags @maybe_message @maybe_comment \ No newline at end of file + curl.exe -L https://github.com/OneBlue/wti/releases/download/v0.1.8/wti.exe -o triage/wti.exe + + cd triage && echo -n $message | .\wti.exe --issue ${{ inputs.issue }} --config config.yml --github-token "${{ inputs.token }}" --ignore-tags @maybe_message @maybe_comment @maybe_previous_body \ No newline at end of file diff --git a/.github/workflows/issue_edited.yml b/.github/workflows/issue_edited.yml new file mode 100644 index 0000000..6518963 --- /dev/null +++ b/.github/workflows/issue_edited.yml @@ -0,0 +1,40 @@ +name: Process edited issue + +on: + workflow_dispatch: + issues: + types: [edited] + +jobs: + getSimilarIssues: + runs-on: ubuntu-latest + outputs: + message: ${{ steps.getBody.outputs.message }} + steps: + - uses: actions/checkout@v2 + - id: getBody + uses: craigloewen-msft/GitGudSimilarIssues@main + with: + issueTitle: ${{ github.event.issue.title }} + issueBody: ${{ github.event.issue.body }} + repository: ${{ github.repository }} + similarityTolerance: "0.7" + commentBody: | + # View similar issues + Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it! + wti: + name: Run wti + needs: getSimilarIssues + runs-on: windows-2022 + permissions: + issues: write + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - uses: ./.github/actions/triage + with: + similar_issues_text: "${{ needs.getSimilarIssues.outputs.message }}" + issue: "${{ github.event.issue.number }}" + previous_body: "${{ github.event.changes.body.from }}" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file