Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

feat: Add YOLO_OBB

feat: Add YOLO_OBB #58

name: Slash Command Dispatch
on:
issue_comment:
types: [created]
env:
commands_list: |
jira
issue_commands_list: |
jira
jobs:
slashCommandDispatch:
if: startsWith(github.event.comment.body, '/')
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3.0.0
- name: 'Validate command'
id: determine_command
uses: actions/github-script@v7
env:
COMMANDS_LIST: ${{ env.commands_list }}
ISSUE_COMMANDS_LIST: ${{ env.issue_commands_list }}
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const body = context.payload.comment.body.toLowerCase().trim()
const commands_list = process.env.COMMANDS_LIST.split("\n")
const issue_commands_list = process.env.ISSUE_COMMANDS_LIST.split("\n")
console.log("Detected PR comment: " + body)
console.log("Commands list: " + commands_list)
console.log("Issue commands list: " + issue_commands_list)
commandArray = body.split(/\s+/)
const contextCommand = commandArray[0].split('/')[1].trim();
console.log("contextCommand: " + contextCommand)
core.setOutput('command_state', 'known')
core.setOutput('is_issue_command', 'false')
if (! commands_list.includes(contextCommand)) {
core.setOutput('command_state', 'unknown')
core.setOutput('command', contextCommand)
}
if (issue_commands_list.includes(contextCommand)) {
core.setOutput('is_issue_command', 'true')
}
- name: Slash Command Dispatch for Issues
id: scd_issues
if: ${{ steps.determine_command.outputs.command_state != 'unknown' && steps.determine_command.outputs.is_issue_command == 'true' }}
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ secrets.GIT_PAT }}
reaction-token: ${{ secrets.GIT_PAT }}
issue-type: "issue"
reactions: true
commands: ${{ env.issue_commands_list }}
- name: Slash Command Dispatch for PRs
id: scd_prs
if: ${{ steps.determine_command.outputs.command_state != 'unknown' && steps.determine_command.outputs.is_issue_command != 'true' }}
uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ secrets.GIT_PAT }}
reaction-token: ${{ secrets.GIT_PAT }}
issue-type: "pull-request"
reactions: true
commands: ${{ env.commands_list }}
- name: Edit comment with error message
if: ${{ steps.determine_command.outputs.command_state == 'unknown' }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
body: |
> '/${{ steps.determine_command.outputs.command }}' is an unknown command.
> See '/help'
reactions: eyes, confused