-
Notifications
You must be signed in to change notification settings - Fork 0
Update develop: improve PR body handling and auto-merge conditions #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,14 +126,19 @@ jobs: | |
| id: create_pr | ||
| if: steps.check_diff.outputs.diff == 'true' && steps.check_pr.outputs.result == 'false' | ||
| run: | | ||
| URL=$(gh pr create -B develop -H main --title 'CI: Update develop to match main' --body 'Merge main into develop to update the develop branch to the latest version\n\n${{ inputs.pr_description || '' }}' --label develop-update --label ci) | ||
| PR_BODY='Merge main into develop to update the develop branch to the latest version' | ||
| if [ -n "$PR_DESCRIPTION" ]; then | ||
| PR_BODY="${PR_BODY}"$'\n\n'"${PR_DESCRIPTION}" | ||
| fi | ||
| URL=$(gh pr create -B develop -H main --title 'CI: Update develop to match main' --body "$PR_BODY" --label develop-update --label ci) | ||
| echo "URL=$URL" >> $GITHUB_OUTPUT | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| PR_DESCRIPTION: ${{ inputs.pr_description }} | ||
|
|
||
| # Auto merge handling | ||
| - name: "Check if latest commit was a merge commit from develop" | ||
| if: steps.create_pr.outputs.URL != '' && inputs.auto_merge == true | ||
| if: steps.create_pr.outputs.URL != '' && inputs.auto_merge != false | ||
| id: check_merge_source | ||
| run: | | ||
| # Check if latest commit is a merge commit | ||
|
|
@@ -176,7 +181,7 @@ jobs: | |
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: "Auto-merge Pull Request" | ||
| if: steps.check_merge_source.outputs.latest_from_develop == 'true' | ||
| if: steps.check_merge_source.outputs.latest_from_develop == 'true' && inputs.auto_merge != false | ||
|
||
| run: | | ||
| gh pr merge "${{ steps.create_pr.outputs.URL }}" -t "chore(ci): Auto update develop to match main [skip ci]" -b "This was done automatically by the CI pipeline" --merge | ||
| env: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition
inputs.auto_merge != falseis problematic because wheninputs.auto_mergeis not provided (null/empty), the comparison!= falseevaluates to true, which means this step will run even when auto_merge is not explicitly set. This changes the behavior from the original== truecondition, which would only run when auto_merge is explicitly true (or uses the default value of true).In GitHub Actions, when comparing boolean inputs, you should use string comparisons. The correct condition should be:
inputs.auto_merge == true || inputs.auto_merge == 'true'if you want to handle both boolean and string representations, or keep the original== trueif the default value handling is sufficient.