@argos-ci/gitlab 0.7.20 → 0.8.0

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/cli.mjs CHANGED
@@ -4,13 +4,13 @@ import { resolve } from "node:path";
4
4
  import { program } from "commander";
5
5
  import { createClient } from "@argos-ci/api-client";
6
6
  import { Gitlab } from "@gitbeaker/rest";
7
- //#region src/statuses.ts
7
+ // src/statuses.ts
8
8
  /**
9
9
  * Run the main logic of the action.
10
10
  */
11
11
  async function run(input) {
12
12
  const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
13
- const { data: project, error: projectError } = await argosClient.GET("/project");
13
+ const { data: project, error: projectError } = await argosClient.GET("/project", { params: { query: { project: input.argosProject } } });
14
14
  if (projectError) {
15
15
  console.error(projectError);
16
16
  throw new Error(projectError.error);
@@ -52,19 +52,21 @@ async function run(input) {
52
52
  * Upate GitLab commit statuses based on Argos builds.
53
53
  */
54
54
  async function updateGitLabCommitStatuses(input) {
55
+ const argos = createClient({ authToken: input.argosToken });
56
+ const gitlab = new Gitlab({
57
+ oauthToken: input.gitlab.authToken,
58
+ host: input.gitlab.baseUrl
59
+ });
55
60
  await run({
56
- argosClient: createClient({ authToken: input.argosToken }),
57
- gitlabClient: new Gitlab({
58
- oauthToken: input.gitlab.authToken,
59
- host: input.gitlab.baseUrl
60
- }),
61
+ argosClient: argos,
62
+ argosProject: input.argosProject,
63
+ gitlabClient: gitlab,
61
64
  gitlabProjectId: input.gitlab.projectId,
62
65
  commit: input.commit,
63
66
  pullInterval: input.pullInterval ?? 3e3
64
67
  });
65
68
  }
66
- //#endregion
67
- //#region src/config.ts
69
+ // src/config.ts
68
70
  /**
69
71
  * Get the configuration from the environment variables.
70
72
  */
@@ -77,6 +79,7 @@ function getConfig() {
77
79
  return {
78
80
  commit: process.env.CI_COMMIT_SHA,
79
81
  argosToken: process.env.ARGOS_TOKEN,
82
+ argosProject: process.env.ARGOS_PROJECT || void 0,
80
83
  gitlab: {
81
84
  projectId: process.env.CI_PROJECT_ID,
82
85
  authToken: process.env.ARGOS_GITLAB_TOKEN,
@@ -84,8 +87,7 @@ function getConfig() {
84
87
  }
85
88
  };
86
89
  }
87
- //#endregion
88
- //#region src/cli.ts
90
+ // src/cli.ts
89
91
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
90
92
  const rawPkg = await readFile(resolve(__dirname, "..", "package.json"), "utf8");
91
93
  const pkg = JSON.parse(rawPkg);
@@ -101,5 +103,4 @@ program.command("update-statuses").description("Update GitLab commit statuses ba
101
103
  });
102
104
  if (!process.argv.slice(2).length) program.outputHelp();
103
105
  else program.parse(process.argv);
104
- //#endregion
105
106
  export {};
package/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/statuses.d.ts
2
1
  /**
3
2
  * Upate GitLab commit statuses based on Argos builds.
4
3
  */
@@ -6,24 +5,27 @@ export declare function updateGitLabCommitStatuses(input: {
6
5
  commit: string;
7
6
  pullInterval?: number;
8
7
  argosToken: string;
8
+ /**
9
+ * Argos project, as `owner/project`. Required when the token is linked to
10
+ * several projects.
11
+ */
12
+ argosProject?: string | undefined;
9
13
  gitlab: {
10
14
  projectId: string;
11
15
  authToken: string;
12
16
  baseUrl: string;
13
17
  };
14
18
  }): Promise<void>;
15
- //#endregion
16
- //#region src/config.d.ts
17
19
  /**
18
20
  * Get the configuration from the environment variables.
19
21
  */
20
22
  export declare function getConfig(): {
21
23
  commit: string;
22
24
  argosToken: string;
25
+ argosProject: string | undefined;
23
26
  gitlab: {
24
27
  projectId: string;
25
28
  authToken: string;
26
29
  baseUrl: string;
27
30
  };
28
- };
29
- //#endregion
31
+ };
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createClient } from "@argos-ci/api-client";
2
2
  import { Gitlab } from "@gitbeaker/rest";
3
- //#region src/statuses.ts
3
+ // src/statuses.ts
4
4
  /**
5
5
  * Run the main logic of the action.
6
6
  */
7
7
  async function run(input) {
8
8
  const { argosClient, gitlabClient, gitlabProjectId, pullInterval, commit } = input;
9
- const { data: project, error: projectError } = await argosClient.GET("/project");
9
+ const { data: project, error: projectError } = await argosClient.GET("/project", { params: { query: { project: input.argosProject } } });
10
10
  if (projectError) {
11
11
  console.error(projectError);
12
12
  throw new Error(projectError.error);
@@ -48,19 +48,21 @@ async function run(input) {
48
48
  * Upate GitLab commit statuses based on Argos builds.
49
49
  */
50
50
  async function updateGitLabCommitStatuses(input) {
51
+ const argos = createClient({ authToken: input.argosToken });
52
+ const gitlab = new Gitlab({
53
+ oauthToken: input.gitlab.authToken,
54
+ host: input.gitlab.baseUrl
55
+ });
51
56
  await run({
52
- argosClient: createClient({ authToken: input.argosToken }),
53
- gitlabClient: new Gitlab({
54
- oauthToken: input.gitlab.authToken,
55
- host: input.gitlab.baseUrl
56
- }),
57
+ argosClient: argos,
58
+ argosProject: input.argosProject,
59
+ gitlabClient: gitlab,
57
60
  gitlabProjectId: input.gitlab.projectId,
58
61
  commit: input.commit,
59
62
  pullInterval: input.pullInterval ?? 3e3
60
63
  });
61
64
  }
62
- //#endregion
63
- //#region src/config.ts
65
+ // src/config.ts
64
66
  /**
65
67
  * Get the configuration from the environment variables.
66
68
  */
@@ -73,6 +75,7 @@ function getConfig() {
73
75
  return {
74
76
  commit: process.env.CI_COMMIT_SHA,
75
77
  argosToken: process.env.ARGOS_TOKEN,
78
+ argosProject: process.env.ARGOS_PROJECT || void 0,
76
79
  gitlab: {
77
80
  projectId: process.env.CI_PROJECT_ID,
78
81
  authToken: process.env.ARGOS_GITLAB_TOKEN,
@@ -80,5 +83,4 @@ function getConfig() {
80
83
  }
81
84
  };
82
85
  }
83
- //#endregion
84
86
  export { getConfig, updateGitLabCommitStatuses };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/gitlab",
3
3
  "description": "GitLab utilities for visual testing with Argos.",
4
- "version": "0.7.20",
4
+ "version": "0.8.0",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -14,12 +14,14 @@
14
14
  "url": "https://github.com/argos-ci/argos-javascript/issues"
15
15
  },
16
16
  "keywords": [
17
- "gitlab",
18
17
  "argos",
18
+ "argos-ci",
19
+ "gitlab",
20
+ "gitlab-ci",
21
+ "merge-request",
19
22
  "testing",
20
- "visual testing",
21
- "regression",
22
- "visual regression"
23
+ "visual-testing",
24
+ "visual-regression-testing"
23
25
  ],
24
26
  "publishConfig": {
25
27
  "access": "public"
@@ -47,12 +49,12 @@
47
49
  "lint": "eslint ."
48
50
  },
49
51
  "dependencies": {
50
- "@argos-ci/api-client": "0.31.2",
52
+ "@argos-ci/api-client": "0.32.0",
51
53
  "@gitbeaker/rest": "^43.8.0",
52
- "commander": "^15.0.0"
54
+ "commander": "^15.1.0"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@types/node": "catalog:"
56
58
  },
57
- "gitHead": "e9d0b2fb39001683230eff86f9c39e0016b5cf27"
59
+ "gitHead": "96ca00234edc12d322416295a4abebbc8471b696"
58
60
  }