Skip to content

Instantly share code, notes, and snippets.

@nwtgck
Last active March 10, 2024 11:19
Show Gist options
  • Save nwtgck/a9b291f6869db42ecc3d9e30d0a0494c to your computer and use it in GitHub Desktop.
Save nwtgck/a9b291f6869db42ecc3d9e30d0a0494c to your computer and use it in GitHub Desktop.
name: "Comment run"
on:
issue_comment:
types: [created, edited]
jobs:
comment-run:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
# 0 indicates all history
fetch-depth: 0
- uses: nwtgck/actions-comment-run@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
allowed-associations: '["OWNER"]'
@ibnesayeed
Copy link

Add following under the comment-run job to skip it when not effective:

    # Skip the job if the comment does not conatin the trigger phrase
    if: contains(github.event.comment.body, '@github-actions run')

@nwtgck
Copy link
Author

nwtgck commented Jun 6, 2020

Thanks!

Adding if: contains(github.event.comment.body, '@github-actions run') reduces the computation of GitHub Actions. I don't update the yml for keeping yaml short, but very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment