-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rebase PR if all status check is OK #24
Comments
ThoughtThe user seems to be asking if it's possible to automatically rebase a Pull Request with GitHub Actions when all status checks are OK but it's not up-to-date with the main branch. I understand that the user wants to have all PR's to be updated automatically to maintain a clean codebase and to eliminate any merge conflicts that would arise due to older codebases. The answer to the question is yes, it's possible using GitHub Actions. You would need to create a custom workflow file that includes a job designed to trigger on the event status 'success'. Then, in the job instructions, you could use git commands to checkout the relevant branch and perform the rebase operation. Or there are some existing GitHub Actions available that can help with this. はい、可能です。GitHub Actions を使用して、この自動化を実現することができます。カスタムのワークフローファイルを作成し、そのファイルに 'success' ステータスイベントをトリガーにするジョブを含めることが必要です。その後、ジョブの指示で関連するブランチをチェックアウトし、rebase 操作を実行する git コマンドを使用できます。また、すでに存在するGitHub Actionsを利用することも可能です。これによって、すべてのステータスチェックが OK であり、最新のメインブランチに追従していないときに自動的に Pull Request を rebase することができます。これにより、コードベースを綺麗に保ち、古いコードベースによって生じる可能性のあるマージコンフリクトを排除することができます。 |
サンプルの設定を作成してください |
ThoughtThe user has asked for a sample configuration. I'll provide them a sample GitHub Actions workflow yaml file that would trigger a rebase when all status checks are OK and if PR is not up-to-date with the main branch. こちらが要求されたGitHub Actionsのサンプル設定です。この設定では、すべてのステータスチェックがOKで、かつPRが最新のmainブランチに追随していない場合にrebaseをトリガーします。 name: Auto Rebase
on:
status:
jobs:
rebase:
name: auto rebase
if: github.event.state == 'success'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0
- name: Rebase
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git rebase origin/main
``` 当然、実際の使用では信頼できる外部actionを使う方が効果的であることが多いです。これらの外部actionは認証、エラーハンドリングなどのための追加のシェルスクリプトを提供します。 |
project root: /home/hiromi/git/oss/auto-issue-resolver
PRのステータスがすべてOKになっているのに最新のmainブランチに追随できていない場合、自動でrebaseする処理をgithub action に足すことは出来ますか?
The text was updated successfully, but these errors were encountered: