Skip to content

Conversation

Copy link

Copilot AI commented Jan 15, 2026

  • Create .github/workflows/rebase-upstream-prod.yml workflow file
    • Add schedule trigger (weekly, Sunday night UTC)
    • Add workflow_dispatch for manual runs
    • Add concurrency control to prevent race conditions
    • Use blacksmith-4vcpu-ubuntu-2404 runner for consistency
    • Checkout opensoft-prod branch
    • Add and fetch upstream remote (sst/opencode)
    • Fetch latest production branch from upstream
    • Rebase opensoft-prod onto upstream/production
    • Force push on success
    • Remove continue-on-error to properly report workflow status
    • Create issue on conflict with properly formatted instructions
    • Fix issue body indentation using .trim()
    • Remove confusing Labels section from issue body
  • Create .github/rebase-upstream-prod-conflict.md with manual resolution instructions
    • Fix conflict marker documentation to correctly explain rebase semantics
  • Validate workflow syntax
Original prompt

Create a GitHub Actions workflow file in .github/workflows/rebase-upstream-prod.yml that will do the following:

  • Run weekly (scheduled, e.g. every Sunday night UTC) and support manual runs (workflow_dispatch).
  • Identify the correct remotes:
    • origin = opensoft/opencode (the fork)
    • upstream = sst/opencode (the parent repo)
  • Checkout the opensoft-prod branch from origin.
  • Add and fetch from upstream if not present (git remote add upstream https://github.com/sst/opencode.git).
  • Fetch the latest production branch from upstream.
  • Rebase opensoft-prod onto upstream/production.
  • If rebase succeeds with no conflicts, force push to origin/opensoft-prod.
  • If there are conflicts during rebase, abort and create a GitHub Issue alerting maintainers (with instructions for manual conflict resolution in .github/rebase-upstream-prod-conflict.md).

Also, add .github/rebase-upstream-prod-conflict.md file with a clear description of how to resolve rebase conflicts manually.

Do not modify other files or workflows.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: brettheap <1513478+brettheap@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for rebase upstream Add automated workflow to rebase opensoft-prod onto upstream production Jan 15, 2026
Copilot AI requested a review from brettheap January 15, 2026 23:28
@brettheap brettheap requested a review from Copilot January 15, 2026 23:29
@brettheap brettheap marked this pull request as ready for review January 15, 2026 23:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automated rebase workflow to keep the opensoft-prod branch synchronized with the upstream sst/opencode:production branch.

Changes:

  • Adds a GitHub Actions workflow that runs weekly (Sunday 23:00 UTC) or manually to rebase opensoft-prod onto upstream production
  • Implements conflict detection and automated issue creation with idempotent conflict tracking
  • Provides comprehensive documentation for manual conflict resolution

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
.github/workflows/rebase-upstream-prod.yml Automated rebase workflow with scheduled and manual triggers, conflict handling, and GitHub issue creation
.github/rebase-upstream-prod-conflict.md Step-by-step manual conflict resolution guide referenced in auto-generated issues

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 89 to 131
const issueBody = `## Automated Rebase Failed

The automated rebase of \`opensoft-prod\` onto
\`upstream/production\` has encountered conflicts that require
manual resolution.

**Workflow Run:** [#${context.runNumber}](${
context.payload.repository.html_url
}/actions/runs/${context.runId})

## What Happened

The GitHub Actions workflow attempted to:
1. Fetch the latest \`production\` branch from upstream
(sst/opencode)
2. Rebase \`opensoft-prod\` onto \`upstream/production\`
3. The rebase encountered merge conflicts and was aborted

## Next Steps

A maintainer needs to manually resolve the conflicts and
push the rebased branch. Please follow the instructions
below:

---

${instructions}

---

## After Resolution

Once you've manually resolved and pushed the changes:
- [ ] Verify \`opensoft-prod\` is up to date with
\`upstream/production\`
- [ ] Close this issue
- [ ] The next automated run should succeed

## Labels

- \`automated\`: Created by automated workflow
- \`maintenance\`: Repository maintenance task
`;
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue body template string has significant whitespace indentation that will appear in the generated GitHub issue. The leading spaces before each line (lines 91-130) will be preserved in the issue body, causing unwanted indentation. Consider using template literal dedenting or removing the leading whitespace from these lines.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 0adcd98. Added .trim() to the template literal to remove leading indentation while maintaining YAML validity. The issue body will now render without unwanted whitespace.

Comment on lines 127 to 130
## Labels

- \`automated\`: Created by automated workflow
- \`maintenance\`: Repository maintenance task
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Labels" section in the issue body (lines 127-130) appears to be documentation about the labels rather than actual label application. This will be confusing in the generated issue since the labels are already applied via the labels array in the API call. Consider removing this section or clarifying that these are the applied labels.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed in commit 0adcd98. The "Labels" section has been removed from the issue body.

Comment on lines 39 to 52
- name: Rebase onto upstream/production
id: rebase
continue-on-error: true
run: |
echo "Attempting rebase of opensoft-prod onto upstream/production..."
if git rebase upstream/production; then
echo "result=success" >> $GITHUB_OUTPUT
echo "Rebase successful"
else
echo "result=conflict" >> $GITHUB_OUTPUT
echo "Rebase failed with conflicts"
git rebase --abort
exit 1
fi
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rebase step uses 'continue-on-error: true' which means the step will always report success to GitHub Actions even when it fails. This could lead to the workflow showing as successful when it actually encountered conflicts. Consider removing 'continue-on-error' and handling the failure through conditional steps, or ensure monitoring relies on the outputs rather than the overall workflow status.

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already fixed in commit 0adcd98. Removed continue-on-error: true and updated the condition to failure() && steps.rebase.outputs.result == 'conflict' so the workflow properly reports its status.

brettheap and others added 2 commits January 15, 2026 15:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
brettheap and others added 2 commits January 15, 2026 15:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…move Labels section

Co-authored-by: brettheap <1513478+brettheap@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brettheap brettheap merged commit e8f02ce into dev Jan 16, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants