Conversation
|
This pull request has been marked to automatically sync to its base branch. You can disable this behavior by removing the label. |
❌ 12 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Pull request overview
This PR implements a fork detection check in the autoupdater to skip pull requests that originate from forked repositories. The autoupdate action is designed to automatically update PR branches when changes land on their destination branch, and this change prevents it from attempting to update fork-based PRs, which could fail or cause unexpected behavior.
Changes:
- Added a check in the
prNeedsUpdatemethod to detect and skip pull requests from forks by comparing the full repository names of the head and base
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -266,6 +266,11 @@ export class AutoUpdater { | |||
| return false; | |||
| } | |||
There was a problem hiding this comment.
This line accesses pull.base.repo.full_name without checking if pull.base.repo is null or undefined. While the base repository should typically exist for all pull requests, the type system allows it to be null. Consider adding a null check similar to the one for pull.head.repo at line 262 to prevent potential runtime errors.
| } | |
| } | |
| if (!pull.base.repo) { | |
| ghCore.warning( | |
| `Skipping pull request, base repository appears to be unavailable.`, | |
| ); | |
| return false; | |
| } |
| if (pull.head.repo.full_name !== pull.base.repo.full_name) { | ||
| ghCore.info('Pull request is from a fork, skipping...'); | ||
| return false; | ||
| } | ||
|
|
||
| try { |
There was a problem hiding this comment.
The new fork detection logic lacks test coverage. The test file (test/autoupdate.test.ts) contains extensive tests for the prNeedsUpdate function, but none that verify this new fork check behaves correctly. Consider adding test cases for: 1) a PR from a fork (where head.repo.full_name differs from base.repo.full_name) to verify it returns false and logs the appropriate message, and 2) a PR from the same repository to verify it continues with normal processing.
No description provided.