Skip to content

Instantly share code, notes, and snippets.

@gimKondo
Created June 10, 2020 15:59
Show Gist options
  • Save gimKondo/1cac9b7133d6eb279ccaff4f5ec7324a to your computer and use it in GitHub Desktop.
Save gimKondo/1cac9b7133d6eb279ccaff4f5ec7324a to your computer and use it in GitHub Desktop.
Deploy feature branch by pull request comment
name: deploy dev from feature by pull request
on:
issue_comment:
types:
- created
jobs:
deploy:
# add comment of pull request && comment is KEYWORD
if: (github.event.issue.pull_request != null) && github.event.comment.body == '!github deploy-feature'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v2
id: set-target-branch
with:
github-token: ${{secrets.GITHUB_TOKEN}}
result-encoding: string
script: |
const pull_request = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
return pull_request.data.head.ref
- uses: actions/checkout@v2
with:
ref: ${{ steps.set-target-branch.outputs.result }}
- name: Deploy
run: echo "Deploy Action is here"
- name: Slack Notification
uses: homoluctus/slatify@master
if: always()
with:
type: ${{ job.status }}
job_name: "Deploy to Dev Firebase (${{ steps.set-target-branch.outputs.result }})"
mention: "here"
mention_if: "failure"
url: ${{ secrets.SLACK_WEBHOOK_URL }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment