-
Notifications
You must be signed in to change notification settings - Fork 132
ci: implementing migrator workflow #3878
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
…n migrator workflow
…nd enhancing checkout process
…ling with improved branch checks and comments
…nd adding existence check for new branch
…d updating comment structure
…istence message formatting
…prove body formatting
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
…ments with improved messaging
…migrator workflow
I think this is more or less ready. The conflict in the changes is still not clear to me, so I would appreciate any suggestions on this. Pinging @RobPasMue since I discussed this topic with him and pinging @klmcadams because i would love her feedback on the conflict resolution. |
Hi @germa89, I've resolved conflicts with cherry-picks like this, but I found this |
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.
Overall looks good =)
@klmcadams @RobPasMue can you check the conflict logic in 03bfc29 Additionally, since this is almost ready, pinging @ansys/pyansys-core for awareness, since this might become part of |
@sourcery-ai review |
Reviewer's GuideThis pull request implements a new GitHub Actions workflow, Sequence Diagram for Successful PR Migration by
|
Change | Details | Files |
---|---|---|
Implemented a new GitHub Actions workflow (migrator.yml ) to automate migrating fork PRs to the base repository, enabling CI processes requiring secrets. |
|
/.github/workflows/migrator.yml |
Developed the core logic for fetching, merging (with automated conflict resolution), and pushing forked PR changes into a new base repository branch, and managing the associated PR. |
|
/.github/workflows/migrator.yml |
Enhanced communication by adding steps to post status updates as comments on the original pull request. |
|
/.github/workflows/migrator.yml |
Added a changelog entry to document the introduction of the new migrator CI workflow. |
|
/doc/changelog.d/3878.maintenance.md |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai review
on the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issue
to create an issue from it. - Generate a pull request title: Write
@sourcery-ai
anywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai title
on the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summary
anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summary
on the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guide
on the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolve
on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismiss
on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai review
to trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
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.
Hey @germa89 - I've reviewed your changes - here's some feedback:
- The git operations for syncing an existing migrated branch may not function as intended due to
git checkout -b
and an earliergit pull
targeting an unexpected branch. - Confirm that automatically resolving merge conflicts by taking the fork's changes (
--theirs
) is the desired behavior when syncing, as it will overwrite any direct modifications to the migrated branch in the base repository.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
echo "Resolving conflicts by taking 'theirs' changes" | ||
git checkout --theirs . | ||
git add . | ||
|
||
# Verify if conflicts are resolved | ||
REMAINING_CONFLICTS=$(git ls-files -u | wc -l) | ||
if [ "$REMAINING_CONFLICTS" -gt 0 ]; then | ||
echo "Error: Conflicts remain after resolution. Aborting." | ||
exit 1 | ||
fi |
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.
suggestion (bug_risk): Review automatic conflict resolution strategy.
Confirm that automatically using 'git checkout --theirs' won’t discard crucial PR changes.
Suggested implementation:
# Resolve conflicts by taking "theirs" changes if AUTO_RESOLVE flag is set.
if [ "$AUTO_RESOLVE" == "true" ]; then
echo "Auto-resolving conflicts using 'theirs' strategy"
git checkout --theirs .
git add .
else
echo "Automatic conflict resolution is disabled. Please resolve conflicts manually."
exit 1
fi
Ensure that the environment variable AUTO_RESOLVE is defined in your workflow configuration or the environment. This change guarantees that using the "theirs" strategy does not inadvertently discard crucial PR changes without explicit confirmation.
@germa89 The bot makes a good point about accidentally overwriting files. Is |
Summary
As the title.
This pull request introduces a new GitHub Actions workflow,
migrator.yml
, designed to handle pull requests originating from forks. The workflow ensures that secrets required for CI processes can be accessed by migrating the forked PR into a branch within the base repository.Changes
New Workflow: Added migrator.yml to workflows.
Trigger Events:
@pyansys-ci-bot migrate
or@pyansys-ci-bot sync
on pull requests.workflow_dispatch
with an issue number input.Key Steps:
This workflow simplifies the process of handling forked pull requests, improving developer experience.
Example of fork PR: #3868
Example of migrated PR: #3886
Summary by Sourcery
Implement a GitHub Actions workflow to migrate pull requests from forks, enabling secure CI processes and improving developer experience
New Features:
CI:
Chores: