@factorialco/gat 3.3.0 → 3.3.1
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/workflow.js +17 -4
- package/package.json +2 -2
package/dist/workflow.js
CHANGED
|
@@ -9,9 +9,10 @@ const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const util_1 = require("util");
|
|
12
|
-
const
|
|
12
|
+
const rest_1 = require("@octokit/rest");
|
|
13
13
|
const step_1 = require("./step");
|
|
14
14
|
const writeFilePromise = (0, util_1.promisify)(fs_1.default.writeFile);
|
|
15
|
+
let firstCompileCall = true;
|
|
15
16
|
const supplyChainAttack = async (step, compileOptions) => {
|
|
16
17
|
const { lockFilePath, writeLockFile = false } = compileOptions;
|
|
17
18
|
if (!(0, step_1.isUseStep)(step))
|
|
@@ -25,6 +26,10 @@ const supplyChainAttack = async (step, compileOptions) => {
|
|
|
25
26
|
if (!match)
|
|
26
27
|
return uses;
|
|
27
28
|
const { repository, version } = match.groups;
|
|
29
|
+
if (firstCompileCall && writeLockFile && fs_1.default.existsSync(lockFilePath)) {
|
|
30
|
+
firstCompileCall = false;
|
|
31
|
+
fs_1.default.rmSync(lockFilePath);
|
|
32
|
+
}
|
|
28
33
|
const chainAttackCache = fs_1.default.existsSync(lockFilePath)
|
|
29
34
|
? JSON.parse(fs_1.default.readFileSync(lockFilePath, "utf8"))
|
|
30
35
|
: {};
|
|
@@ -33,9 +38,17 @@ const supplyChainAttack = async (step, compileOptions) => {
|
|
|
33
38
|
if (!writeLockFile) {
|
|
34
39
|
throw new Error(`Unable to retrieve ${uses} from lock file and writeLockFile is false`);
|
|
35
40
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
41
|
+
const [owner, repo] = repository.split("/");
|
|
42
|
+
const octokit = process.env.GITHUB_TOKEN
|
|
43
|
+
? new rest_1.Octokit({
|
|
44
|
+
auth: process.env.GITHUB_TOKEN,
|
|
45
|
+
})
|
|
46
|
+
: new rest_1.Octokit();
|
|
47
|
+
const response = await octokit.rest.repos.listTags({
|
|
48
|
+
owner,
|
|
49
|
+
repo,
|
|
50
|
+
});
|
|
51
|
+
const tag = response.data.find((tag) => tag.name === version);
|
|
39
52
|
if (!tag) {
|
|
40
53
|
throw new Error(`Unable to retrieve ${uses} from Github tags`);
|
|
41
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/gat",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Write your GitHub Actions workflows using TypeScript",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gat": "dist/cli.js"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vitest": "^0.34.6"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"
|
|
41
|
+
"@octokit/rest": "^21.1.1",
|
|
42
42
|
"js-yaml": "^4.1.0",
|
|
43
43
|
"lodash": "^4.17.21"
|
|
44
44
|
},
|