Skip to content

Comments

Add scheduled workflow to auto-sync fork with upstream#632

Closed
i-chaochen wants to merge 1 commit intomainfrom
chao/sync-upstream-main
Closed

Add scheduled workflow to auto-sync fork with upstream#632
i-chaochen wants to merge 1 commit intomainfrom
chao/sync-upstream-main

Conversation

@i-chaochen
Copy link
Collaborator

@i-chaochen i-chaochen commented Feb 23, 2026

https://github.com/ROCm/xla/tree/rocm-dev-infra

📝 Summary of Changes
Add a GitHub Actions workflow that keeps the rocm/xla fork's main branch in sync with openxla/xla using the merge-upstream API.

Runs every 3 hours on weekdays and once daily on weekends, with a manual workflow_dispatch trigger available for on-demand syncing.

🎯 Justification
Later on, the only divergence for our rocm/xla:main between openxla/xla:main is under .github and this can help us to setup AI agent to code review and more performance CIs

Add a GitHub Actions workflow that keeps the rocm/xla fork's main
branch in sync with openxla/xla using the merge-upstream API.

Runs every 3 hours on weekdays and once daily on weekends, with a
manual workflow_dispatch trigger available for on-demand syncing.
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 a GitHub Actions workflow to automatically keep the rocm/xla fork synchronized with its upstream repository (openxla/xla). The workflow is designed to run on a schedule - every 3 hours on weekdays and once daily on weekends - with an additional option for manual triggering. This automation supports the long-term goal of maintaining minimal divergence between the fork and upstream, primarily limited to .github directory differences, which will facilitate AI-assisted code review and enhanced CI capabilities.

Changes:

  • Added a new scheduled GitHub Actions workflow that uses the GitHub merge-upstream API to automatically sync the main branch
  • Configured dual scheduling: 8 times daily (every 3 hours) on weekdays and once daily at 09:00 UTC on weekends
  • Included manual workflow_dispatch trigger for on-demand syncing

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

@@ -0,0 +1,23 @@
name: Sync Fork with Upstream
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

This workflow file is missing the standard Apache 2.0 copyright header that is consistently used across all other workflow files in this repository. All other workflow files in .github/workflows/ include a copyright header at the top (see ci.yml:1-14, rocm_xla_ci.yml:1-14, ci_multi_device.yml:1-14, cpu_benchmarks_nightly.yml:1-14, buildifier.yml:1-14, etc.). Please add the copyright header to maintain consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +23
gh api \
--method POST \
/repos/${{ github.repository }}/merge-upstream \
-f branch=main
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The workflow lacks error handling and notification mechanisms. If the merge-upstream API call fails (e.g., due to merge conflicts, API errors, or authentication issues), the workflow will silently fail without notifying anyone. Consider adding error handling to capture failure scenarios and optionally send notifications (e.g., via GitHub Actions failure notifications or by creating an issue) so that merge conflicts or other problems can be addressed promptly.

Suggested change
gh api \
--method POST \
/repos/${{ github.repository }}/merge-upstream \
-f branch=main
set -euo pipefail
BRANCH="main"
if ! gh api \
--method POST \
/repos/${{ github.repository }}/merge-upstream \
-f branch="${BRANCH}"; then
echo "::error::Failed to sync fork with upstream for branch '${BRANCH}'. Check for merge conflicts, API errors, or authentication issues."
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
run: |
gh api \
--method POST \
/repos/${{ github.repository }}/merge-upstream \
-f branch=main
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Consider adding a conditional check or configuration to handle situations where the upstream and fork have diverged significantly and automatic merging may not be appropriate. The workflow description mentions that "the only divergence for our rocm/xla:main between openxla/xla:main is under .github," but if this assumption is violated in the future, automatic merging could cause issues. Consider adding a check to ensure the merge is only attempted when it's safe to do so, or documenting the expected state clearly.

Copilot uses AI. Check for mistakes.
Copy link

@nurmukhametov nurmukhametov left a comment

Choose a reason for hiding this comment

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

I am confused why the target branch is main. Should it be rocm-dev-infra?

@i-chaochen
Copy link
Collaborator Author

i-chaochen commented Feb 23, 2026

I am confused why the target branch is main. Should it be rocm-dev-infra?

Yes, since we have rocm-dev-infra as the default, we don't need this PR anymore.

Later on, we can put code review and performance CI there for our internal release branches

rocm-dev-infra branch
├── .github/
│   └── workflows/
│       ├── sync_upstream.yml          # Auto-sync main with upstream
│       ├── claude_code_review.yml     # Claude AI review on PRs
│       └── rocm_perf_benchmark.yml    # Post-submit perf CI
└── README.md

@i-chaochen i-chaochen closed this Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants