rollback to pre v07 #117
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: Auto Backmerge Master => Staging | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
back_merge_to_staging: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Check if Master is Ahead of Staging | |
run: | | |
git fetch origin staging | |
AHEAD=$(git rev-list origin/master ^origin/staging | wc -l) | |
echo "AHEAD: $AHEAD" | |
if [ $AHEAD -gt 0 ]; then | |
echo "merge_to_staging=true" >> $GITHUB_ENV | |
fi | |
- name: Create Pull Request to Staging | |
if: env.merge_to_staging == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.DEVOPS_USER_PR_BUNDLER }} | |
run: | | |
# Create PR using GitHub REST API | |
REPO_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1) | |
REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls \ | |
-d '{"head": "master", "base": "staging", "title": "Auto Back Merge from Master", "body": "This is an automatically generated back merge from master to staging."}' |