on:
  pull_request:
    branches:
      - staging
    types:
      - closed

jobs:
  create_pull_request_to_production:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged
    steps:
      - uses: actions/github-script@0.8.0
        with:
          script: |
            console.log(context)
            github.pulls.create({
              owner: context.repo.owner,
              repo: context.repo.repo,
              title: context.payload.pull_request.title.replace(/deploy to staging/i, 'Deploy to Production'),
              head: context.ref,
              base: 'master',
              body: context.event.pull_request.body
            })

Add Github Action for creating a pull request to production.
Add Github Action for creating a pull request to production.
