Add auto-merge workflow for small content changes - 2 files or less#4108
Add auto-merge workflow for small content changes - 2 files or less#4108jakebayliss wants to merge 10 commits intomainfrom
Conversation
Coverage report
Test suite run success13 tests passing in 1 suite. Report generated by 🧪jest coverage report action from 880e663 |
|
Deployed changes to https://app-sswwebsite-9eb3-pr-4108.azurewebsites.net |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a GitHub Actions workflow to automatically merge small content changes, specifically targeting PRs with 2 or fewer files changed in the content/ and public/ directories. The workflow aims to streamline the review process for minor content updates by eliminating manual approval steps.
Key changes:
- Implements auto-detection of small content-only changes
- Adds automated PR commenting for transparency
- Enables automatic squash merging for eligible PRs
|
Deployed changes to https://app-sswwebsite-9eb3-pr-4108.azurewebsites.net |
|
Deployed changes to https://app-sswwebsite-9eb3-pr-4108.azurewebsites.net |
🚀 Lighthouse score comparison for PR slot and production
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@wicksipedia I've opened a new pull request, #4378, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@wicksipedia I've opened a new pull request, #4379, to work on those changes. Once the pull request is ready, I'll request review from you. |
Addresses review feedback to extract the `maxFiles` PowerShell variable
to a job-level environment variable, making it properly accessible
throughout the workflow.
**Changes:**
- Added `MAX_FILES: 2` as job-level environment variable in
`detect-small-changes` job
- Updated PowerShell script to read from `$env:MAX_FILES` instead of
hardcoded value
- Fixed comment step to use `${{ env.MAX_FILES }}` (previously
referenced undefined `$maxFiles` in GitHub Actions context)
- Exposed as job output for potential cross-job usage
**Before:**
```yaml
run: |
$maxFiles = 2
# ...later in different step
message: |
- Maximum ${{ $maxFiles }} file... # ❌ undefined in Actions context
```
**After:**
```yaml
env:
MAX_FILES: 2
outputs:
max-files: ${{ env.MAX_FILES }}
steps:
run: |
$maxFiles = [int]$env:MAX_FILES
# ...later in different step
message: |
- Maximum ${{ env.MAX_FILES }} file... # ✅ properly scoped
```
- Affected routes: N/A (GitHub Actions workflow only)
- [ ] If adding a new page, I have followed the [📃 New
Webpage](https://github.com/SSWConsulting/SSW.Website/issues/new?assignees=&labels=&projects=&template=new_webpage.yml&title=%F0%9F%93%84+%7B%7B+TITLE+%7D%7D+)
issue template
- [ ] If updating the livestream banner, I have tested and followed the
steps in [Wiki - Testing the live
banner](https://github.com/SSWConsulting/SSW.Website/wiki/Testing-the-live-banner)
- [ ] Include Done Video or screenshots
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wicksipedia <600044+wicksipedia@users.noreply.github.com>
…ng (#4379) Restructured the auto-merge workflow to ensure comments are posted reliably in all scenarios, including when the merge step fails with an exception. **Changes:** - Created a new `comment-result` job that runs separately from the `auto-merge` job - Job uses `if: always()` to ensure it runs even when the auto-merge job fails - Split comments into two conditional steps based on `needs.auto-merge.result`: - `Comment merge success` - Runs only when merge succeeds, includes "This PR was automatically merged as a small content change." - `Comment merge failure` - Runs only when merge fails, shows error message only **Before:** ```yaml # Comments were steps within the auto-merge job - name: Comment merge result if: always() with: message: | ${{ steps.auto-merge-pr.outcome == 'success' && '✅ **Auto-merge completed successfully!**' || '❌ **Auto-merge failed**' }} This PR was automatically merged as a small content change. ``` **After:** ```yaml # Comments are now in a separate job that acts as a catch-all comment-result: name: Comment Merge Result needs: [detect-small-changes, auto-merge] if: always() && needs.detect-small-changes.outputs.is-small-change == 'true' steps: - name: Comment merge success if: needs.auto-merge.result == 'success' with: message: | ✅ **Auto-merge completed successfully!** This PR was automatically merged as a small content change. - name: Comment merge failure if: needs.auto-merge.result == 'failure' with: message: | ❌ **Auto-merge failed** - Please check the workflow logs for details. ``` **Benefits:** - Failure comments now post even if the auto-merge job encounters an exception - Better separation of concerns between merging and status reporting - More reliable feedback to PR authors in all scenarios - Affected routes: N/A (workflow change only) - [ ] If adding a new page, I have followed the [📃 New Webpage](https://github.com/SSWConsulting/SSW.Website/issues/new?assignees=&labels=&projects=&template=new_webpage.yml&title=%F0%9F%93%84+%7B%7B+TITLE+%7D%7D+) issue template - [ ] If updating the livestream banner, I have tested and followed the steps in [Wiki - Testing the live banner](https://github.com/SSWConsulting/SSW.Website/wiki/Testing-the-live-banner) - [ ] Include Done Video or screenshots <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wicksipedia <600044+wicksipedia@users.noreply.github.com>
|
Deployed changes to https://app-sswwebsite-9eb3-pr-4108.azurewebsites.net |
🚀 Lighthouse score comparison for PR slot and production
|
|
@wicksipedia I tested this against a repo of mine. It will work, but only triggers when the user moves the PR from
Figure: workflow working on private repo |
|
Closing this - We've decided to go for an approach that uses agentic workflows instead |
Pull request was closed

Small content changes require users to open GitHub, mark the created PR as Ready, get others to review, wait for builds, etc. We should be able to auto-approve/merge these small PRs.
As per my conversation with Uly, we will start off by auto-approving PR with <= 2 files changed. This allows for a rule and an image for example.
Fixed #3965
Created POC repo to test the auto-merge:
