From 65cfd0fd7b714cd5dd3ca2c393eefea11a80a32e Mon Sep 17 00:00:00 2001 From: Malcolm Crum Date: Thu, 28 Mar 2024 22:35:37 +1300 Subject: [PATCH] try trigger - but it doesn't work --- .github/workflows/build.yml | 7 ++++- .github/workflows/comment.yml | 57 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/comment.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c68a14..3ae24f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,10 @@ on: - push + push: + workflow_call: + inputs: + environment: + type: string + required: true jobs: auto-deploy: diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml new file mode 100644 index 0000000..63be687 --- /dev/null +++ b/.github/workflows/comment.yml @@ -0,0 +1,57 @@ +# Listens for specific comments in PRs and triggers a build + +name: Build Trigger + +on: issue_comment + +jobs: + building_reaction: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.reactions.createForIssueComment({ + comment_id: context.payload.comment.id, + content: 'ROCKET' + }) + + prerelease_deploy: + name: deploy to pre-release + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'deploy to pre-release') }} + uses: ./.github/workflows/build.yml@${{ github.event.pull_request.base.ref }} + secrets: inherit + with: + environment: pre-release + dev_deploy: + name: deploy to dev + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'deploy to dev') }} + uses: ./.github/workflows/build.yml@${{ github.event.pull_request.base.ref }} + secrets: inherit + with: + environment: dev + # Not doing prod-deploy - merge to main first + + # respond with a thumbs up + done_prerelease: + runs-on: ubuntu-latest + needs: prerelease_deploy + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.reactions.createForIssueComment({ + comment_id: context.payload.comment.id, + content: '+1' + }) + done_dev: + runs-on: ubuntu-latest + needs: dev_deploy + steps: + - uses: actions/github-script@v7 + with: + script: | + github.rest.reactions.createForIssueComment({ + comment_id: context.payload.comment.id, + content: '+1' + })