Skip to content

Commit cc24211

Browse files
committed
Always fetch in CI before getting the processors, because they will not be able to get a diff without fetching first
1 parent ebcb789 commit cc24211

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/processors.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ import {
1010
} from "./git";
1111
import type { Range } from "./Range";
1212

13+
if (process.env.CI !== undefined) {
14+
const branch = process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? guessBranch();
15+
if (branch !== undefined) {
16+
process.env.ESLINT_PLUGIN_DIFF_COMMIT = branch;
17+
fetchFromOrigin(branch);
18+
}
19+
}
20+
1321
/**
1422
* Exclude unchanged files from being processed
1523
*
@@ -101,16 +109,6 @@ const getProcessors = (
101109
processorType: ProcessorType
102110
): Required<Linter.Processor> => {
103111
const staged = processorType === "staged";
104-
if (processorType === "ci") {
105-
if (process.env.CI === undefined) {
106-
throw Error("Expected CI environment");
107-
}
108-
109-
const branch = process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? guessBranch();
110-
if (branch !== undefined) {
111-
fetchFromOrigin(branch);
112-
}
113-
}
114112
const untrackedFileList = getUntrackedFileList(staged);
115113
const diffFileList = getDiffFileList(staged);
116114

0 commit comments

Comments
 (0)