# Deploys a preview when someone comments "/deploy" on a pull request.
# Anyone can comment, and the job runs with the deploy key.
name: Deploy on comment

on:
  issue_comment:
    types: [created]

jobs:
  deploy:
    if: contains(github.event.comment.body, '/deploy')
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
      - uses: actions/checkout@v4
      - name: Deploy
        run: ./scripts/deploy.sh "${{ github.event.comment.body }}"
        env:
          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
