Update prod (#631) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync | |
on: | |
push: | |
branches: | |
- prod | |
jobs: | |
branch-sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Check if there are changes between prod and master | |
id: check_diff | |
run: | | |
git fetch origin master | |
git diff --quiet origin/master..origin/prod || (echo "changes detected" && exit 0) || exit 1 | |
- name: Reset sync branch | |
run: | | |
git fetch origin prod:prod | |
git reset --hard prod | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.MY_GITHUB_TOKEN }} | |
branch: prod-sync | |
base: master | |
title: "Sync changes from prod to master" | |
body: "This PR is automatically generated to sync changes from prod to master." | |
labels: "sync,automated pr" | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.MY_GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: merge | |
- name: Auto approve | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |