-
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
GitAuto: [BUG] Check if actions requested to checkout the repository are not in a external pull request #655
GitAuto: [BUG] Check if actions requested to checkout the repository are not in a external pull request #655
Conversation
Here's the code health analysis summary for commits Analysis Summary
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Quality Gate passedIssues Measures |
Infisical secrets check: ✅ No secrets leaked! 💻 Scan logs5:40PM INF scanning for exposed secrets...
5:40PM INF 650 commits scanned.
5:40PM INF scan completed in 146ms
5:40PM INF no leaks found
|
Resolves #93
Why the bug occurs
When the bot processes the
@gstraccini csharpier
command on a pull request, it attempts to checkout the PR branch from the original repository without considering whether the PR originates from a forked repository. If the PR comes from a fork, the bot doesn't have the necessary permissions to access the forked repository, causing the checkout action to fail. The bot doesn't provide any feedback to the user about this failure, leading to confusion.How to reproduce
@gstraccini csharpier
on the PR.How to fix
Modify the bot's workflow to detect if a PR originates from a forked repository. If it does, the bot should:
Implementation Steps:
Check if the PR is from a fork:
In the GitHub Actions workflow handling the
@gstraccini csharpier
command, add a step to determine if the PR is from a forked repository by checking thegithub.event.pull_request.head.repo.fork
property.Conditionally perform actions based on the fork status:
Update the workflow to only attempt to checkout and run actions if the PR is not from a fork.
Comment on the PR if it is from a fork:
If the PR is from a forked repository, use the
actions/github-script
action to post a comment informing the user.By implementing these changes, the bot will properly handle PRs from forked repositories by notifying users of the permission limitations instead of failing silently. This improves user experience by providing clear feedback and avoids unnecessary action failures.
Test these changes locally