@factorialco/gat 3.4.2 → 3.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/template.js +25 -8
- package/package.json +1 -1
package/dist/template.js
CHANGED
|
@@ -32,15 +32,32 @@ const createLockFile = async (templates, lockFilePath) => {
|
|
|
32
32
|
return;
|
|
33
33
|
const { repository, version } = match.groups;
|
|
34
34
|
const [owner, repo] = repository.split("/");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
if (/^[a-f0-9]{40}$/.test(version)) {
|
|
36
|
+
// Assume version is a SHA
|
|
37
|
+
resolvedActions[action] = `${repository}@${version}`;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
let tag = null;
|
|
41
|
+
let page = 1;
|
|
42
|
+
const perPage = 100;
|
|
43
|
+
while (!tag) {
|
|
44
|
+
const response = await octokit.rest.repos.listTags({
|
|
45
|
+
owner,
|
|
46
|
+
repo,
|
|
47
|
+
per_page: perPage,
|
|
48
|
+
page,
|
|
49
|
+
});
|
|
50
|
+
tag = response.data.find((tag) => tag.name === version);
|
|
51
|
+
if (response.data.length < perPage) {
|
|
52
|
+
break; // No more pages to check
|
|
53
|
+
}
|
|
54
|
+
page++;
|
|
55
|
+
}
|
|
56
|
+
if (!tag) {
|
|
57
|
+
throw new Error(`Unable to retrieve ${action} from Github tags`);
|
|
58
|
+
}
|
|
59
|
+
resolvedActions[action] = `${repository}@${tag.commit.sha}`;
|
|
42
60
|
}
|
|
43
|
-
resolvedActions[action] = `${repository}@${tag.commit.sha}`;
|
|
44
61
|
}));
|
|
45
62
|
fs_1.default.writeFileSync(lockFilePath, JSON.stringify(resolvedActions, null, 2));
|
|
46
63
|
};
|