Skip to content

Commit c1a9304

Browse files
chore: use specific version for demo-java-x repo parsing
1 parent f489ce2 commit c1a9304

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

packages/java-parser/scripts/clone-samples.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,30 @@ const sampleRepos = [
8282
},
8383
{
8484
repoUrl: "https://github.com/nipafx/demo-java-x",
85-
branch: "main"
85+
branch: "main",
86+
commitHash: "b9facd7bae57512793af4e197446d8064318bf04"
8687
}
8788
];
8889

8990
fs.emptyDirSync(samplesDir);
9091

9192
sampleRepos.forEach(cloneRepo);
9293

93-
function cloneRepo({ repoUrl, branch }) {
94+
function cloneRepo({ repoUrl, branch, commitHash }) {
9495
console.log(`cloning ${repoUrl}`);
95-
cp.execSync(`git clone ${repoUrl} --branch ${branch} --depth 1`, {
96-
cwd: samplesDir,
97-
stdio: [0, 1, 2]
98-
});
96+
if (commitHash) {
97+
cp.execSync(`git clone ${repoUrl} --branch ${branch}`, {
98+
cwd: samplesDir,
99+
stdio: [0, 1, 2]
100+
});
101+
cp.execSync(`git checkout ${commitHash}`, {
102+
cwd: path.resolve(samplesDir, repoUrl.split("/").pop()),
103+
stdio: [0, 1, 2]
104+
});
105+
} else {
106+
cp.execSync(`git clone ${repoUrl} --branch ${branch} --depth 1`, {
107+
cwd: samplesDir,
108+
stdio: [0, 1, 2]
109+
});
110+
}
99111
}

0 commit comments

Comments
 (0)