diff --git a/.github/workflows/open_pull_request.yml b/.github/workflows/open_pull_request.yml index 91b1b4411..8aac13af5 100644 --- a/.github/workflows/open_pull_request.yml +++ b/.github/workflows/open_pull_request.yml @@ -30,6 +30,13 @@ jobs: exit 0 fi + # Check if there are any commits between branches + COMMITS=$(gh api "repos/${{ github.repository }}/compare/${TARGET_BRANCH}...${SOURCE_BRANCH}" --jq '.total_commits') + if [ "$COMMITS" -eq 0 ]; then + echo "No commits between $TARGET_BRANCH and $SOURCE_BRANCH. Skipping PR creation." + exit 0 + fi + # Try to create the PR gh pr create \ --base "$TARGET_BRANCH" \