#TIL 4 - Trigger github action base on the comment

Aug 20, 2020 · Dung Huynh

What

Run GitHub Actions workflows when specific comments are posted on issues/PRs.

Why

Enable manual deployments via comments without push access or creating branches.

How

# .github/workflows/comment.yml
on:
  issue_comment:
    types: [created, edited]

name: Deploy action
jobs:
  web-image:
    runs-on: ubuntu-latest
    if: github.event.comment.body == 'Build web'
    steps:
      - run: echo "Deploying..."