Skip to content

Commit

Permalink
Create sync-dev-main.yml (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
iploooox authored Oct 6, 2024
1 parent 5be552f commit 52d7d75
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/sync-dev-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Sync Development to Main

on:
push:
branches:
- development
workflow_dispatch:

jobs:
create-sync-pr:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Create or update sync branch
run: |
git checkout -B sync-development-to-main origin/development
git push -f origin sync-development-to-main
- name: Create or update pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_EXISTS=$(gh pr list --base main --head sync-development-to-main --json number --jq length)
if [ "$PR_EXISTS" -eq "0" ]; then
gh pr create --base main --head sync-development-to-main \
--title "Sync Development to Main" \
--body "This PR syncs the latest changes from the development branch to the main branch."
else
gh pr edit --base main --head sync-development-to-main \
--title "Sync Development to Main" \
--body "This PR syncs the latest changes from the development branch to the main branch."
fi

0 comments on commit 52d7d75

Please sign in to comment.