Skip to content

Commit

Permalink
Add logic to process new logs when an issue is edited (#11544)
Browse files Browse the repository at this point in the history
* Add logic to review edited issues if log files were added

* Add workflow

* yaml

* yaml

* yaml

* yaml

* yaml
  • Loading branch information
OneBlue authored May 3, 2024
1 parent a873439 commit 676a8c9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/actions/triage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ inputs:
token:
required: false
type: string
previous_body:
required: false
type: string

runs:
using: "composite"
steps:
- 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 = @'
Expand All @@ -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")
}
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
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
40 changes: 40 additions & 0 deletions .github/workflows/issue_edited.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 676a8c9

Please sign in to comment.