Skip to content

Commit

Permalink
Merge pull request #56 from movementlabsxyz/l-monninger/infra-integra…
Browse files Browse the repository at this point in the history
…tion

fix: testing workflow.
  • Loading branch information
l-monninger authored May 12, 2024
2 parents 41c70a8 + e7e0e54 commit 0347dce
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
name: Infra
name: Handle Target Comment

on:
issue_comment:
types: [created, edited]
workflow_dispatch:
inputs:
comment:
description: 'Comment from issue_comment event'
required: true
type: string

jobs:
handle-comment:
runs-on: ubuntu-latest
steps:
- name: Output the comment
run: |
echo "Comment was: ${{ github.event.inputs.comment }}"
manage-infra-pr:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, 'infra')
if: startsWith(github.event.inputs.comment, 'infra')
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/target-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Comment Trigger Workflow

on:
issue_comment:
types: [created, edited]

jobs:
dispatch-workflow:
runs-on: ubuntu-latest
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"
- 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: Triggered by Comment
token: ${{ secrets.GITHUB_TOKEN }}
inputs: '{"comment": "${{ github.event.comment.body }}"}'
ref: ${{ fromJson(steps.get_pr.outputs.data).head.ref }}
repo: ${{ fromJson(steps.get_pr.outputs.data).head.repo.full_name }}

0 comments on commit 0347dce

Please sign in to comment.