-
Notifications
You must be signed in to change notification settings - Fork 75
ci: add workflow to auto-rebase feature branches #2290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add a GitHub Actions workflow that automatically rebases long-running feature branches onto main when changes are pushed to main. Features: - Triggers on push to main branch - Rebases configured feature branches (develop-v2, develop-v1.5.0, develop-v1.6.0) - Creates timestamped backup branches before force pushing - Uses --force-with-lease for safer force pushes - Sends Slack notifications on success or failure - Only force pushes if rebase actually changed history Security: - Uses GitHub App token for authentication (bypasses branch protection) - Explicit permissions block (contents: write) - Uses jq for safe JSON construction in Slack payloads - Environment variables passed via env: block to prevent injection 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this 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 rebase long-running feature branches (develop-v2, develop-v1.5.0, develop-v1.6.0) onto main whenever commits are pushed to the main branch. The workflow creates timestamped backups before force-pushing, uses --force-with-lease for safety, and sends Slack notifications on both success and failure scenarios.
Key Changes
- Automated rebase workflow triggered on push to
mainwith backup and force-push safety mechanisms - GitHub App token-based authentication for git operations
- Slack notification system for rebase success/failure with detailed branch status reporting
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The $'\n' syntax produces actual newline characters that jq will properly JSON-encode, rather than literal backslash-n which would be double-escaped. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Co-authored-by: Copilot <[email protected]>
Summary
Adds a GitHub Actions workflow that automatically keeps long-running feature branches rebased onto
main. This reduces manual maintenance overhead and ensures feature branches stay current.How it works
main- When commits are merged/pushed to main, the workflow runsorigin/maindevelop-v2-backup-20241202-143052)Configured branches
develop-v2develop-v1.5.0develop-v1.6.0Safety features
--force-with-lease- Prevents overwriting unexpected changesSecurity
REBASE_APP_IDandREBASE_APP_PRIVATE_KEYsecrets)permissions: contents: writeblockjqfor safe JSON construction in Slack payloads (prevents injection)env:block rather than inline${{ }}interpolationPrerequisites
The following secrets must be configured:
REBASE_APP_ID- GitHub App IDREBASE_APP_PRIVATE_KEY- GitHub App private keySLACK_WEBHOOK_URL- Slack incoming webhook URLThe GitHub App needs write access to repository contents.
Test plan
mainand observe workflow execution🤖 Generated with Claude Code