Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed May 8, 2024
1 parent 6073535 commit 7430c96
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/sync-pro.yml
Expand Up @@ -10,6 +10,9 @@ jobs:
if: ${{ github.repository == 'udecode/plate' && contains('refs/heads/main',github.ref)}}
name: Sync Pro
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v4
Expand All @@ -24,8 +27,6 @@ jobs:
git config user.email '<>'
PUSH_BRANCH=main
PUSH_FORCE=''
git fetch $DOWNSTREAM main
git checkout $DOWNSTREAM/main -- yarn.lock # Checkout yarn.lock from downstream before merging
git pull --no-rebase --no-edit $DOWNSTREAM main || {
# Got merge conflicts, so fall back to upstream branch
git merge --abort
Expand All @@ -36,7 +37,7 @@ jobs:
env:
DOWNSTREAM: https://${{secrets.DOWNSTREAM_REPO_GITHUB_CREDENTIALS}}@github.com/plate-pro/plate-pro.git

# Open a PR if a branch called 'upstream' recieves commits on downstream
# Open a PR if a branch called 'upstream' receives commits on downstream
upstream_pr:
if: ${{ github.repository == 'plate-pro/plate-pro' && contains('refs/heads/upstream',github.ref)}}
name: Upstream PR
Expand All @@ -46,6 +47,12 @@ jobs:
uses: actions/checkout@v4

- name: Create PR
run: gh pr create --title 'Sync upstream' --body ''
run: |
PR_EXIST=$(gh pr list | grep 'Sync upstream')
if [ -z "$PR_EXIST" ]; then
gh pr create --title 'Sync upstream' --body 'This PR synchronizes changes from the upstream branch.'
else
echo "Pull request already exists."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 7430c96

Please sign in to comment.