Skip to content

Comment commands

Comment commands #577

name: Comment commands
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
jobs:
check_user_permission:
runs-on: ubuntu-latest
name: A job to check user's permission level
steps:
- name: Check user permission (write)
id: check-write
uses: actions-cool/check-user-permission@v2
with:
require: 'write'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Abort
if: steps.check-write.outputs.check-result == 'false'
run: exit 1
mythx_partial:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
outputs:
run: ${{ steps.check.outputs.triggered }}
mode: ${{ steps.mode.outputs.mode }}
steps:
- uses: khan/pull-request-comment-trigger@v1.1.0
id: check
with:
trigger: '/mythx partial'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get mode
id: mode
run: |
mode=$(echo "$BODY" | sed "s|/mythx partial ||" | sed "s/ //")
echo "mode=$mode" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
mythx_partial_run:
needs: ['mythx_partial']
if: needs.mythx_partial.outputs.run == 'true'
uses: './.github/workflows/mythx-changed.yml'
with:
pr_number: ${{ github.event.issue.number }}
mode: ${{ needs.mythx_partial.outputs.mode }}
secrets: inherit
mythx_full:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
outputs:
run: ${{ steps.check.outputs.triggered }}
mode: ${{ steps.mode.outputs.mode }}
steps:
- uses: khan/pull-request-comment-trigger@v1.1.0
id: check
with:
trigger: '/mythx full'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get mode
id: mode
run: |
mode=$(echo "$BODY" | sed "s|/mythx full ||" | sed "s/ //")
echo "mode=$mode" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
mythx_full_run:
needs: ['mythx_full']
if: needs.mythx_full.outputs.run == 'true'
uses: './.github/workflows/mythx-full.yml'
with:
mode: ${{ needs.mythx_full.outputs.mode }}
secrets: inherit
release_label:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
steps:
- uses: khan/pull-request-comment-trigger@v1.1.0
id: check
with:
trigger: '/release'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get type
id: type
run: |
type=$(echo "$BODY" | sed "s|/release ||" | sed "s/ //")
echo "type=$type" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
- name: add label
if: steps.check.outputs.triggered == 'true'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: release:${{ steps.type.outputs.type }}
subgraph_label:
needs: [check_user_permission]
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request }}
steps:
- uses: khan/pull-request-comment-trigger@v1.1.0
id: check
with:
trigger: '/subgraph'
prefix_only: true
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- name: Get type
id: type
run: |
type=$(echo "$BODY" | sed "s|/subgraph ||" | sed "s/ //")
echo "type=$type" >> $GITHUB_OUTPUT
env:
BODY: ${{ github.event.comment.body }}
- name: add label
if: steps.check.outputs.triggered == 'true'
uses: actions-ecosystem/action-add-labels@v1
with:
labels: subgraph:${{ steps.type.outputs.type }}