Skip to content

🔄 Sync with upstream changes (#7) #7

🔄 Sync with upstream changes (#7)

🔄 Sync with upstream changes (#7) #7

name: Create PR from main to prod
on:
push:
branches:
- main
workflow_dispatch: # Allow manual trigger
jobs:
create-prod-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch all branches
run: git fetch origin
- name: Check if prod branch exists and has differences
id: check
run: |
# Check if prod branch exists
if git rev-parse --verify origin/prod >/dev/null 2>&1; then
# Branch exists, check for differences
if git diff --quiet origin/prod origin/main; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "branch_exists=true" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "branch_exists=true" >> $GITHUB_OUTPUT
fi
else
# Branch doesn't exist, create it
echo "changes=true" >> $GITHUB_OUTPUT
echo "branch_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request from main to prod
if: steps.check.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--head main \
--base prod \
--title "🚀 Deploy main changes to prod" \
--body "## Deploy to Production
Latest changes from main are ready for production deployment.
**Approve this PR to start the build** - the build will be automatically triggered on the prod branch.
---
*Auto-generated by main-to-prod workflow*"