This commit is contained in:
Moritz Utcke
2025-04-28 17:18:45 -03:00
parent 4b9e7dda5f
commit 76bd0bb5dd

View File

@@ -33,33 +33,22 @@ jobs:
exit 1 exit 1
fi fi
- name: Checkout staging and create branch - name: Create PR from staging to main
id: create_branch
run: |
git checkout -b auto-merge/staging-to-main origin/staging
git push origin auto-merge/staging-to-main
- name: Create PR from staging → main
id: create_pr id: create_pr
uses: peter-evans/create-pull-request@v4 run: |
with: PR_URL=$(gh pr create --base main --head staging --title "Auto-merge staging into main" --body "This PR was created automatically by GitHub Actions. It merges the latest \`staging\` into \`main\`.")
token: ${{ secrets.GITHUB_TOKEN }} echo "PR_URL=$PR_URL" >> $GITHUB_OUTPUT
commit-message: "chore: auto-merge staging into main" PR_NUMBER=$(echo $PR_URL | awk -F'/' '{print $NF}')
branch: auto-merge/staging-to-main echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
base: main env:
title: "Auto-merge staging into main" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
body: |
This PR was created automatically by GitHub Actions.
It merges the latest `staging` into `main`.
draft: false
- name: Enable auto-merge on PR - name: Enable auto-merge on PR
if: steps.create_pr.outputs.pull-request-number != '' if: steps.create_pr.outputs.PR_NUMBER != ''
uses: peter-evans/enable-pull-request-automerge@v3 run: |
with: gh pr merge ${{ steps.create_pr.outputs.PR_NUMBER }} --merge --auto
token: ${{ secrets.GITHUB_TOKEN }} env:
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
merge-method: merge
notify_failure: notify_failure: