Skip to content

Implement fork check and skip#97

Open
MattyTheHacker wants to merge 3 commits intomainfrom
ignore-forks
Open

Implement fork check and skip#97
MattyTheHacker wants to merge 3 commits intomainfrom
ignore-forks

Conversation

@MattyTheHacker
Copy link
Member

No description provided.

@MattyTheHacker MattyTheHacker self-assigned this Feb 13, 2026
Copilot AI review requested due to automatic review settings February 13, 2026 14:01
@MattyTheHacker MattyTheHacker added the enhancement New feature or request label Feb 13, 2026
@github-actions github-actions bot added the sync Keep this PR up to date with it's base branch. label Feb 13, 2026
@github-actions
Copy link
Contributor

This pull request has been marked to automatically sync to its base branch. You can disable this behavior by removing the label.

@codecov
Copy link

codecov bot commented Feb 13, 2026

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
95 12 83 0
View the top 3 failed test(s) by shortest run time
test `prNeedsUpdate` pull request has labels with no name
Stack Traces | 0.001s run time
TypeError: Cannot read properties of undefined (reading 'full_name')
    at AutoUpdater.prNeedsUpdate (.../pr-auto-updater/src/autoupdater.ts:269:53)
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:312:39)
    at Promise.finally.completed (.../jest-circus/build/jestAdapterInit.js:1557:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/jestAdapterInit.js:1497:10)
    at _callCircusTest (.../jest-circus/build/jestAdapterInit.js:1007:40)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
    at _runTest (.../jest-circus/build/jestAdapterInit.js:947:3)
    at .../jest-circus/build/jestAdapterInit.js:849:7
    at _runTestsForDescribeBlock (.../jest-circus/build/jestAdapterInit.js:862:11)
    at _runTestsForDescribeBlock (.../jest-circus/build/jestAdapterInit.js:857:11)
    at run (.../jest-circus/build/jestAdapterInit.js:761:3)
    at runAndTransformResultsToJestFormat (.../jest-circus/build/jestAdapterInit.js:1918:21)
    at jestAdapter (.../jest-circus/build/runner.js:101:19)
    at runTestInternal (.../jest-runner/build/testWorker.js:275:16)
    at runTest (.../jest-runner/build/testWorker.js:343:7)
    at Object.worker (.../jest-runner/build/testWorker.js:497:12)
test `prNeedsUpdate` pull request has labels with no name - excluded labels checked
Stack Traces | 0.001s run time
TypeError: Cannot read properties of undefined (reading 'full_name')
    at AutoUpdater.prNeedsUpdate (.../pr-auto-updater/src/autoupdater.ts:269:53)
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:335:39)
    at Promise.finally.completed (.../jest-circus/build/jestAdapterInit.js:1557:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (.../jest-circus/build/jestAdapterInit.js:1497:10)
    at _callCircusTest (.../jest-circus/build/jestAdapterInit.js:1007:40)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
    at _runTest (.../jest-circus/build/jestAdapterInit.js:947:3)
    at .../jest-circus/build/jestAdapterInit.js:849:7
    at _runTestsForDescribeBlock (.../jest-circus/build/jestAdapterInit.js:862:11)
    at _runTestsForDescribeBlock (.../jest-circus/build/jestAdapterInit.js:857:11)
    at run (.../jest-circus/build/jestAdapterInit.js:761:3)
    at runAndTransformResultsToJestFormat (.../jest-circus/build/jestAdapterInit.js:1918:21)
    at jestAdapter (.../jest-circus/build/runner.js:101:19)
    at runTestInternal (.../jest-runner/build/testWorker.js:275:16)
    at runTest (.../jest-runner/build/testWorker.js:343:7)
    at Object.worker (.../jest-runner/build/testWorker.js:497:12)
test `prNeedsUpdate` no filters configured
Stack Traces | 0.003s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:520:32)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request is against branch with auto_merge disabled
Stack Traces | 0.003s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:500:32)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request is against branch with auto_merge enabled
Stack Traces | 0.004s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:477:32)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request labels do match
Stack Traces | 0.005s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:391:28)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request ready state filtering pull request is filtered to drafts only
Stack Traces | 0.005s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:572:35)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request labels do not match
Stack Traces | 0.006s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:363:28)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request ready state filtering pull request ready state is filtered to ready PRs only
Stack Traces | 0.006s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:591:35)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request is not against protected branch
Stack Traces | 0.007s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:444:32)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request ready state filtering pull request ready state is not filtered
Stack Traces | 0.007s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:554:35)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)
test `prNeedsUpdate` pull request is against protected branch
Stack Traces | 0.024s run time
Error: expect(received).toEqual(expected) // deep equality

Expected: true
Received: false
    at Object.<anonymous> (.../pr-auto-updater/test/autoupdate.test.ts:416:32)
    at processTicksAndRejections (node:internal/process/task_queues:104:5)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link

Copilot AI left a 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 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 prNeedsUpdate method 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;
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
}
}
if (!pull.base.repo) {
ghCore.warning(
`Skipping pull request, base repository appears to be unavailable.`,
);
return false;
}

Copilot uses AI. Check for mistakes.
Comment on lines +269 to 274
if (pull.head.repo.full_name !== pull.base.repo.full_name) {
ghCore.info('Pull request is from a fork, skipping...');
return false;
}

try {
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request sync Keep this PR up to date with it's base branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants