Hello, in a current project, we have staging and production environments on Render. I want to be able to deploy to staging when a PR to main is created. The action is expected to deploy the changes in the PR. I have attempted to create a GitHub Action for that, however, it keeps deploying main instead.
This is what the GitHub action looks like, is there something I might be missing?
name: Deploy to Render
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
deploy-to-staging:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
env:
REF: ${{ github.event.pull_request.head.sha }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.0'
- name: Install dependencies
run: bundle install
- name: Deploy to Staging
env:
RENDER_STAGING_WEBHOOK: ${{ secrets.RENDER_STAGING_WEBHOOK }}
run: curl -X POST "${{ env.RENDER_STAGING_WEBHOOK }}&ref=${{ env.REF }}"
Thanks