diff --git a/.github/workflows/develop-update.yml b/.github/workflows/develop-update.yml index b24c53e..ce3cc60 100644 --- a/.github/workflows/develop-update.yml +++ b/.github/workflows/develop-update.yml @@ -36,18 +36,19 @@ jobs: uses: actions/checkout@v4 with: ref: main - + # Ensure diff between main and develop - name: "Check if there is a diff between main and develop" id: check_diff run: | git fetch origin develop - DIFF=$(git diff origin/develop..main) - if [ -z "$DIFF" ]; then - echo "No differences found between main and develop." + # Check if there are commits in main that aren't in develop + COMMITS=$(git rev-list origin/develop..main --count) + if [ "$COMMITS" -eq 0 ]; then + echo "No commits found in main that aren't in develop. Develop is up to date or ahead." echo "diff=false" >> $GITHUB_OUTPUT else - echo "Differences found between main and develop." + echo "Found $COMMITS commit(s) in main that aren't in develop." echo "diff=true" >> $GITHUB_OUTPUT fi - name: "Check if existing PR exists" @@ -119,7 +120,7 @@ jobs: throw error; } } - + # PR Creation - name: "Create Pull Request to update develop branch, and merge it" id: create_pr diff --git a/README.md b/README.md index d086806..47a71c2 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ The workflow intelligently handles different merge scenarios: This ensures that hotfixes and other direct merges to `main` are properly reviewed before being merged back to `develop`. -If a merge is not detected, the main and develop branches are already in sync or an existing PR between main and develop exists, the workflow will exit without merging changes, but will create a PR if possible. +If no commits are found in `main` that aren't in `develop`, or an existing PR between main and develop exists, the workflow will exit without merging changes, but will create a PR if possible. #### Inputs