Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/rebase-conflict-message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
## Rebase Conflict Detected

The automated weekly rebase of `opensoft-prod` onto `production` has encountered merge conflicts and requires manual resolution.

### Steps to Resolve

1. **Clone the repository and fetch latest changes:**
```bash
git fetch origin
```

2. **Checkout the opensoft-prod branch:**
```bash
git checkout opensoft-prod
```

3. **Start the rebase onto production:**
```bash
git rebase origin/production
```

4. **Resolve conflicts:**
- Git will pause at each conflicting commit
- Open the conflicting files and resolve the conflicts manually
- Look for conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`)
- Edit the files to keep the desired changes

5. **After resolving conflicts in each file:**
```bash
git add <resolved-file>
git rebase --continue
```

6. **Repeat steps 4-5 until the rebase is complete**

7. **Force-push the rebased branch:**
```bash
git push --force-with-lease origin opensoft-prod
```

### Need Help?

If you're unsure about resolving conflicts, consider:
- Consulting with the team members who made the conflicting changes
- Using a visual merge tool like `git mergetool`
- Reviewing the commit history: `git log origin/production..origin/opensoft-prod`

### Prevention

To minimize future conflicts:
- Keep `opensoft-prod` regularly synced with `production`
- Coordinate large changes with the team
- Consider breaking large features into smaller, incremental updates
56 changes: 56 additions & 0 deletions .github/workflows/rebase-opensoft-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Rebase opensoft-prod onto production

on:
schedule:
- cron: "0 2 * * 0" # Weekly on Sunday at 2:00 AM UTC
workflow_dispatch:

jobs:
rebase:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Fetch all branches
run: |
git fetch origin production
git fetch origin opensoft-prod

- name: Attempt rebase
id: rebase
run: |
git checkout opensoft-prod
if git rebase origin/production; then
echo "rebase_status=success" >> $GITHUB_OUTPUT
else
echo "rebase_status=conflict" >> $GITHUB_OUTPUT
git rebase --abort
fi

- name: Push rebased branch
if: steps.rebase.outputs.rebase_status == 'success'
run: |
git push --force-with-lease origin opensoft-prod

- name: Create issue on conflict
if: steps.rebase.outputs.rebase_status == 'conflict'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ISSUE_BODY=$(cat .github/rebase-conflict-message.md)
gh issue create \
--title "Rebase Conflict: opensoft-prod onto production" \
--body "$ISSUE_BODY" \
--label "maintenance,rebase-conflict"
Loading