Create README.md #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Listens for specific comments in PRs and triggers a build | |
name: Build Trigger | |
on: issue_comment | |
jobs: | |
listen_for_deploys: | |
if: ${{ github.event.issue.pull_request && (github.event.comment.body == 'deploy to pre-release' || github.event.comment.body == 'deploy to dev') }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: rocket | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.reactions.createForIssueComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: context.payload.comment.id, | |
content: 'rocket' | |
}) | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# could we combine these into one? i don't know how... | |
- id: 'get-branch' | |
run: echo "name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')" >> "$GITHUB_OUTPUT" | |
env: | |
REPO: ${{ github.repository }} | |
PR_NO: ${{ github.event.issue.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: deploy to pre-release | |
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'deploy to pre-release' }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh workflow run build.yml -f environment=pre-release --ref ${{ steps.get-branch.outputs.branch }} | |
- name: deploy to dev | |
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'deploy to dev' }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: gh workflow run build.yml -f environment=dev --ref ${{ steps.get-branch.outputs.branch }} | |
# Not doing prod-deploy - merge to main first |