Update develop: improve PR body handling and auto-merge conditions#10
Update develop: improve PR body handling and auto-merge conditions#10The0mikkel merged 3 commits intomainfrom
Conversation
Merge main into develop to update the develop branch to the latest version\n\n
There was a problem hiding this comment.
Pull Request Overview
This PR improves the GitHub Actions workflow for updating the develop branch by refactoring PR body construction and adding null-safety checks for the auto-merge input parameter.
- Refactored PR body construction to conditionally append custom description
- Added null checks to auto-merge conditions to handle cases where the input is not provided
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # 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 |
There was a problem hiding this comment.
The condition inputs.auto_merge != false is problematic because when inputs.auto_merge is not provided (null/empty), the comparison != false evaluates to true, which means this step will run even when auto_merge is not explicitly set. This changes the behavior from the original == true condition, 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 == true if the default value handling is sufficient.
| if: steps.create_pr.outputs.URL != '' && inputs.auto_merge != false | |
| if: steps.create_pr.outputs.URL != '' && (inputs.auto_merge == true || inputs.auto_merge == 'true') |
| 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 |
There was a problem hiding this comment.
The condition inputs.auto_merge != false has the same issue as line 141. When inputs.auto_merge is not provided or is null, this comparison evaluates to true, allowing auto-merge to proceed even when it shouldn't.
Additionally, this creates an inconsistency: if the condition on line 141 is changed to properly handle the auto_merge input, this line must also be updated to match. Consider using inputs.auto_merge == true to maintain consistency with the input definition which has default: true.
No description provided.