Skip to content

Instantly share code, notes, and snippets.

@xt0rted
Last active May 9, 2021 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xt0rted/55025ea044815d3005b669ac5c04d633 to your computer and use it in GitHub Desktop.
Save xt0rted/55025ea044815d3005b669ac5c04d633 to your computer and use it in GitHub Desktop.
GitHub Actions issue comment workflows
name: Check comments for /commands
on:
issue_comment:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
deployments: write
steps:
- name: Check for /deploy command
uses: xt0rted/slash-command-action@v1.1.0
id: command
continue-on-error: true
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: deploy
reaction: true
reaction-type: rocket
allow-edits: false
permission-level: admin
- name: Get pull request branch
uses: xt0rted/pull-request-comment-branch@v1.3.0
if: steps.command.outputs.command-name == 'deploy'
id: comment-branch
- name: Start deployment
uses: bobheadxi/deployments@v0.5.2
if: steps.command.outputs.command-name == 'deploy'
with:
step: start
# Using GITHUB_TOKEN prevents `deployment` workflows from triggering so a PAT is needed
token: ${{ secrets.DEPLOYMENT_TOKEN }}
env: production
no_override: false
ref: ${{ steps.comment-branch.outputs.head_ref }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment