Skip to content

ENG 546 atomic bridge #604

ENG 546 atomic bridge

ENG 546 atomic bridge #604

name: Comment Trigger Workflow
on:
issue_comment:
types: [created, edited]
jobs:
dispatch-workflow:
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- name: Check if comment is on a PR
id: check_pr
run: |
if [ "${{ github.event.issue.pull_request }}" == "" ]; then
echo "This comment is not on a pull request."
echo "::set-output name=is_pr::false"
else
echo "PR URL: ${{ github.event.issue.pull_request.url }}"
echo "::set-output name=is_pr::true"
fi
- name: Fetch PR Details
if: steps.check_pr.outputs.is_pr == 'true'
id: get_pr
uses: octokit/request-action@v2.x
with:
route: GET ${{ github.event.issue.pull_request.url }}
mediaType: '{"previews": ["shadow-cat"]}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Dispatch Target Workflow
if: steps.check_pr.outputs.is_pr == 'true'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: handle-target-comment.yml
token: ${{ secrets.GH_PAT }}
inputs: >
{
"comment": "${{ github.event.comment.body }}",
"issue_number": "${{ github.event.issue.number }}",
"html_url" : "${{ github.event.issue.html_url }}",
"pr_url" : "${{ github.event.issue.pull_request.url }}"
}
ref: ${{ fromJson(steps.get_pr.outputs.data).head.ref }}
repo: ${{ fromJson(steps.get_pr.outputs.data).head.repo.full_name }}