Test OAV 3.2.12 #312
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: Comment Processor | |
on: | |
issue_comment: | |
types: [created] | |
permissions: {} | |
jobs: | |
comment-handler: | |
permissions: | |
pull-requests: write # to read pull requests and write comments | |
name: Handle ${{ github.event_name }} ${{ github.event.action }} event | |
runs-on: ubuntu-latest | |
steps: | |
- name: Process comment | |
shell: pwsh | |
run: | | |
$payload = echo $env:PAYLOAD | ConvertFrom-Json -AsHashtable | |
if (!$payload.comment -or !$payload.comment.body) { | |
Write-Host "Empty comment, returning..." | |
return | |
} | |
$body = $payload.comment.body.Trim().ToLowerInvariant() | |
$expected = '/pr requestmerge' | |
if ($body -ne $expected) { | |
Write-Host "Comment did not equal '$expected', skipping..." | |
return | |
} | |
$label = 'MergeRequested' | |
Write-Host "gh pr edit $($payload.issue.number) --add-label `"$label`"" | |
gh pr edit $payload.issue.html_url --add-label "$label" | |
if ($LASTEXITCODE) { | |
Write-Warning "Failed to add label" | |
exit $LASTEXITCODE | |
} | |
env: | |
PAYLOAD: ${{ toJson(github.event) }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |