@clechasseur/rs-actions-core 6.0.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2023-2025 Charles Lechasseur, actions-rs team and contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # rs-actions-core
2
+
3
+ This repository contains code that are common to many Rust GitHub actions.
4
+
5
+ The repository has been forked from [actions-rs/core](https://github.com/actions-rs/core).
6
+ The original project published under the name `@actions-rs/core`.
7
+ See [LICENSE](LICENSE) for copyright attribution details.
8
+
9
+ ## Contributing
10
+
11
+ See [CONTRIBUTING](CONTRIBUTING.md).
12
+
13
+ ## Development
14
+
15
+ See [DEVELOPMENT](DEVELOPMENT.md).
@@ -0,0 +1,15 @@
1
+ export type AnnotationLevel = 'notice' | 'warning' | 'failure';
2
+ export interface Annotation {
3
+ path: string;
4
+ start_line: number;
5
+ end_line: number;
6
+ start_column?: number;
7
+ end_column?: number;
8
+ annotation_level: AnnotationLevel;
9
+ message: string;
10
+ title?: string;
11
+ raw_details?: string;
12
+ }
13
+ export declare function escapeData(s: any): string;
14
+ export declare function escapeProperty(s: any): string;
15
+ export declare function annotate(annotation: Annotation): void;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.escapeData = escapeData;
37
+ exports.escapeProperty = escapeProperty;
38
+ exports.annotate = annotate;
39
+ const os = __importStar(require("os"));
40
+ function toCommandValue(input) {
41
+ if (input === null || input === undefined) {
42
+ return '';
43
+ }
44
+ else if (typeof input === 'string' || input instanceof String) {
45
+ return input;
46
+ }
47
+ return JSON.stringify(input);
48
+ }
49
+ function escapeData(s) {
50
+ return toCommandValue(s)
51
+ .replace(/%/g, '%25')
52
+ .replace(/\r/g, '%0D')
53
+ .replace(/\n/g, '%0A');
54
+ }
55
+ function escapeProperty(s) {
56
+ return toCommandValue(s)
57
+ .replace(/%/g, '%25')
58
+ .replace(/\r/g, '%0D')
59
+ .replace(/\n/g, '%0A')
60
+ .replace(/:/g, '%3A')
61
+ .replace(/,/g, '%2C');
62
+ }
63
+ const CMD_STRING = '::';
64
+ function render(level, message, properties) {
65
+ let cmdStr = CMD_STRING + level;
66
+ if (properties && Object.keys(properties).length > 0) {
67
+ cmdStr += ' ';
68
+ let first = true;
69
+ for (const [key, value] of Object.entries(properties)) {
70
+ if (value) {
71
+ if (first) {
72
+ first = false;
73
+ }
74
+ else {
75
+ cmdStr += ',';
76
+ }
77
+ cmdStr += `${key}=${escapeProperty(value)}`;
78
+ }
79
+ }
80
+ }
81
+ cmdStr += `${CMD_STRING}${escapeData(message)}`;
82
+ return cmdStr;
83
+ }
84
+ function annotate(annotation) {
85
+ let level;
86
+ switch (annotation.annotation_level) {
87
+ case 'notice':
88
+ case 'warning':
89
+ level = 'warning';
90
+ break;
91
+ case 'failure':
92
+ level = 'error';
93
+ break;
94
+ }
95
+ const text = render(level, annotation.message, {
96
+ file: annotation.path,
97
+ line: annotation.start_line,
98
+ col: annotation.start_column,
99
+ });
100
+ process.stdout.write(text + os.EOL);
101
+ }
102
+ //# sourceMappingURL=annotations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,gCAKC;AAGD,wCAOC;AA+BD,4BAmBC;AA7FD,uCAAyB;AAkBzB,SAAS,c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AE,CAAC;gBACV,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,GAAG,KAAK,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,GAAG,CAAC;gBAChB,CAAC;gBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,QAAQ,CAAC,UAAsB;IAC7C,IAAI,KAA0B,CAAC;IAC/B,QAAQ,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACpC,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS;YACZ,KAAK,GAAG,SAAS,CAAC;YAClB,MAAM;QACR,KAAK,SAAS;YACZ,KAAK,GAAG,OAAO,CAAC;YAChB,MAAM;IACV,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE;QAC7C,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,IAAI,EAAE,UAAU,CAAC,UAAU;QAC3B,GAAG,EAAE,UAAU,CAAC,YAAY;KAC7B,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,16 @@
1
+ type GitHub = any;
2
+ interface Output {
3
+ title: string;
4
+ summary: string;
5
+ text: string;
6
+ }
7
+ export declare class CheckReporter {
8
+ private readonly client;
9
+ private readonly checkName;
10
+ private checkId;
11
+ constructor(client: GitHub, checkName: string);
12
+ startCheck(status?: 'queued' | 'in_progress' | 'completed'): Promise<number>;
13
+ finishCheck(conclusion: 'cancelled' | 'success' | 'failure' | 'neutral' | 'timed_out' | 'action_required', output: Output): Promise<void>;
14
+ cancelCheck(): Promise<void>;
15
+ }
16
+ export {};
package/dist/checks.js ADDED
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CheckReporter = void 0;
37
+ const github = __importStar(require("@actions/github"));
38
+ class CheckReporter {
39
+ client;
40
+ checkName;
41
+ checkId;
42
+ constructor(client, checkName) {
43
+ this.client = client;
44
+ this.checkName = checkName;
45
+ this.checkId = undefined;
46
+ }
47
+ async startCheck(status) {
48
+ const { owner, repo } = github.context.repo;
49
+ const response = await this.client.checks.create({
50
+ owner: owner,
51
+ repo: repo,
52
+ name: this.checkName,
53
+ head_sha: github.context.sha,
54
+ status: status ?? 'in_progress',
55
+ });
56
+ this.checkId = response.data.id;
57
+ return this.checkId;
58
+ }
59
+ async finishCheck(conclusion, output) {
60
+ const { owner, repo } = github.context.repo;
61
+ await this.client.checks.update({
62
+ owner: owner,
63
+ repo: repo,
64
+ name: this.checkName,
65
+ check_run_id: this.checkId,
66
+ status: 'completed',
67
+ conclusion: conclusion,
68
+ completed_at: new Date().toISOString(),
69
+ output: output,
70
+ });
71
+ return;
72
+ }
73
+ async cancelCheck() {
74
+ const { owner, repo } = github.context.repo;
75
+ await this.client.checks.update({
76
+ owner: owner,
77
+ repo: repo,
78
+ name: this.checkName,
79
+ check_run_id: this.checkId,
80
+ status: 'completed',
81
+ conclusion: 'cancelled',
82
+ completed_at: new Date().toISOString(),
83
+ output: {
84
+ title: this.checkName,
85
+ summary: 'Unhandled error',
86
+ text: 'Check was cancelled due to unhandled error. Check the Action logs for details.',
87
+ },
88
+ });
89
+ return;
90
+ }
91
+ }
92
+ exports.CheckReporter = CheckReporter;
93
+ //# sourceMappingURL=checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAc1C,MAAa,aAAa;IACP,MAAM,CAAS;IACf,SAAS,CAAS;IAC3B,OAAO,CAAqB;IAEpC,YAAY,MAAc,EAAE,SAAiB;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAC3B,CAAC;IAKM,KAAK,CAAC,UAAU,CACrB,MAA+C;QAE/C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QAG5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM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CAAC,SAAS;gBACrB,OAAO,EAAE,iBAAiB;gBAC1B,IAAI,EAAE,gFAAgF;aACvF;SACF,CAAC,CAAC;QAEH,OAAO;IACT,CAAC;CACF;AA1FD,sCA0FC"}
@@ -0,0 +1,13 @@
1
+ import * as exec from '@actions/exec';
2
+ export declare function cargoToolchainArg(toolchain?: string): string;
3
+ export declare function resolveVersion(crate: string): Promise<string>;
4
+ export declare class Cargo {
5
+ private readonly path;
6
+ private readonly toolchain;
7
+ private constructor();
8
+ static get(toolchain?: string): Promise<Cargo>;
9
+ install(program: string, version?: string, primaryKey?: string, restoreKeys?: string[]): Promise<string>;
10
+ call(args: string[], options?: exec.ExecOptions): Promise<number>;
11
+ private callArgs;
12
+ private cargoInstall;
13
+ }
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Cargo = void 0;
37
+ exports.cargoToolchainArg = cargoToolchainArg;
38
+ exports.resolveVersion = resolveVersion;
39
+ const io = __importStar(require("@actions/io"));
40
+ const core = __importStar(require("@actions/core"));
41
+ const exec = __importStar(require("@actions/exec"));
42
+ const cache = __importStar(require("@actions/cache"));
43
+ const http = __importStar(require("@actions/http-client"));
44
+ const path = __importStar(require("path"));
45
+ function cargoToolchainArg(toolchain) {
46
+ if (!toolchain) {
47
+ return '';
48
+ }
49
+ return toolchain.startsWith('+') ? toolchain : `+${toolchain}`;
50
+ }
51
+ async function resolveVersion(crate) {
52
+ const url = `https://crates.io/api/v1/crates/${crate}`;
53
+ const client = new http.HttpClient('@clechasseur/rs-actions-core (https://github.com/clechasseur/rs-actions-core)');
54
+ const resp = await client.getJson(url);
55
+ if (!resp.result) {
56
+ throw new Error('Unable to fetch latest crate version');
57
+ }
58
+ return resp.result.crate.newest_version;
59
+ }
60
+ class Cargo {
61
+ path;
62
+ toolchain;
63
+ constructor(path, toolchain) {
64
+ this.path = path;
65
+ this.toolchain = cargoToolchainArg(toolchain);
66
+ }
67
+ static async get(toolchain) {
68
+ try {
69
+ const path = await io.which('cargo', true);
70
+ return new Cargo(path, toolchain);
71
+ }
72
+ catch (error) {
73
+ core.error('cargo is not installed by default for some virtual environments, \
74
+ see https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions');
75
+ core.error('To install it, use an action such as: https://github.com/actions-rust-lang/setup-rust-toolchain');
76
+ throw error;
77
+ }
78
+ }
79
+ async install(program, version, primaryKey, restoreKeys) {
80
+ if (!version || version === 'latest') {
81
+ version = (await resolveVersion(program)) ?? '';
82
+ }
83
+ primaryKey ??= 'rs-actions-core';
84
+ const paths = [path.join(path.dirname(this.path), program)];
85
+ const programKey = `${program}-${version}-${primaryKey}`;
86
+ const programRestoreKeys = (restoreKeys ?? []).map((key) => `${program}-${version}-${key}`);
87
+ if (primaryKey !== 'no-cache') {
88
+ const cacheKey = await cache.restoreCache(paths, programKey, programRestoreKeys);
89
+ if (cacheKey) {
90
+ core.info(`Using cached \`${program}\` with version \`${version}\``);
91
+ return program;
92
+ }
93
+ }
94
+ const installPath = await this.cargoInstall(program, version);
95
+ if (primaryKey !== 'no-cache') {
96
+ try {
97
+ core.info(`Caching \`${program}\` with key \`${programKey}\``);
98
+ await cache.saveCache(paths, programKey);
99
+ }
100
+ catch (error) {
101
+ if (error.name === cache.ValidationError.name) {
102
+ throw error;
103
+ }
104
+ else if (error.name === cache.ReserveCacheError.name) {
105
+ core.info(error.message);
106
+ }
107
+ else {
108
+ core.info(`[warning] ${error.message}`);
109
+ }
110
+ }
111
+ }
112
+ return installPath;
113
+ }
114
+ async call(args, options) {
115
+ return await exec.exec(this.path, this.callArgs(args), options);
116
+ }
117
+ callArgs(args) {
118
+ return this.toolchain ? [this.toolchain, ...args] : args;
119
+ }
120
+ async cargoInstall(program, version) {
121
+ const args = ['install'];
122
+ if (version !== 'latest') {
123
+ args.push('--version');
124
+ args.push(version);
125
+ }
126
+ args.push(program);
127
+ try {
128
+ core.startGroup(`Installing "${program} = ${version}"`);
129
+ await this.call(args);
130
+ }
131
+ finally {
132
+ core.endGroup();
133
+ }
134
+ return program;
135
+ }
136
+ }
137
+ exports.Cargo = Cargo;
138
+ //# sourceMappingURL=cargo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargo.js","sourceRoot":"","sources":["../../src/commands/cargo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,8CAMC;AAQD,wCAcC;AA1CD,gDAAkC;AAClC,oDAAsC;AACtC,oDAAsC;AACtC,sDAAwC;AACxC,2DAA6C;AAC7C,2CAA6B;AAS7B,SAAgB,iBAAiB,CAAC,SAAkB;IAClD,IAAI,CAAC,SAAS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,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAvID,sBAuIC"}
@@ -0,0 +1,15 @@
1
+ import * as exec from '@actions/exec';
2
+ export interface CargoHackOptions {
3
+ toolchain?: string;
4
+ version?: string;
5
+ primaryKey?: string;
6
+ restoreKeys?: string[];
7
+ }
8
+ export declare class CargoHack {
9
+ private readonly toolchain;
10
+ private constructor();
11
+ static getOrInstall(options?: CargoHackOptions): Promise<CargoHack>;
12
+ static get(toolchain?: string): Promise<CargoHack>;
13
+ static install(options?: CargoHackOptions): Promise<CargoHack>;
14
+ call(args: string[], options?: exec.ExecOptions): Promise<number>;
15
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CargoHack = void 0;
37
+ const os = __importStar(require("os"));
38
+ const io = __importStar(require("@actions/io"));
39
+ const core = __importStar(require("@actions/core"));
40
+ const cargo_1 = require("./cargo");
41
+ class CargoHack {
42
+ toolchain;
43
+ constructor(toolchain) {
44
+ this.toolchain = (0, cargo_1.cargoToolchainArg)(toolchain);
45
+ }
46
+ static async getOrInstall(options) {
47
+ try {
48
+ return await CargoHack.get(options?.toolchain);
49
+ }
50
+ catch (error) {
51
+ core.debug(error.message);
52
+ return await CargoHack.install(options);
53
+ }
54
+ }
55
+ static async get(toolchain) {
56
+ await io.which('cargo-hack', true);
57
+ return new CargoHack(toolchain);
58
+ }
59
+ static async install(options) {
60
+ const cargo = await cargo_1.Cargo.get();
61
+ const cwd = process.cwd();
62
+ process.chdir(os.tmpdir());
63
+ try {
64
+ await cargo.install('cargo-hack', options?.version, options?.primaryKey, options?.restoreKeys);
65
+ return new CargoHack(options?.toolchain);
66
+ }
67
+ finally {
68
+ process.chdir(cwd);
69
+ core.endGroup();
70
+ }
71
+ }
72
+ async call(args, options) {
73
+ const cargo = await cargo_1.Cargo.get(this.toolchain);
74
+ return await cargo.call(['hack', ...args], options);
75
+ }
76
+ }
77
+ exports.CargoHack = CargoHack;
78
+ //# sourceMappingURL=cargoHack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cargoHack.js","sourceRoot":"","sources":["../../src/commands/cargoHack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAkC;AAClC,oDAAsC;AAGtC,mCAAmD;AAuCnD,MAAa,SAAS;IACH,SAAS,CAAS;IAEnC,YAAoB,SAAkB;QACpC,IAAI,CAAC,SAAS,GAAG,IAAA,yBAAiB,EAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAQM,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AI,CAAC,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CACF;AApFD,8BAoFC"}
@@ -0,0 +1,17 @@
1
+ import * as exec from '@actions/exec';
2
+ export interface CrossOptions {
3
+ toolchain?: string;
4
+ version?: string;
5
+ primaryKey?: string;
6
+ restoreKeys?: string[];
7
+ }
8
+ export declare class Cross {
9
+ private readonly path;
10
+ private readonly toolchain;
11
+ private constructor();
12
+ static getOrInstall(options?: CrossOptions): Promise<Cross>;
13
+ static get(toolchain?: string): Promise<Cross>;
14
+ static install(options?: CrossOptions): Promise<Cross>;
15
+ call(args: string[], options?: exec.ExecOptions): Promise<number>;
16
+ private callArgs;
17
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Cross = void 0;
37
+ const os = __importStar(require("os"));
38
+ const io = __importStar(require("@actions/io"));
39
+ const core = __importStar(require("@actions/core"));
40
+ const exec = __importStar(require("@actions/exec"));
41
+ const cargo_1 = require("./cargo");
42
+ class Cross {
43
+ path;
44
+ toolchain;
45
+ constructor(path, toolchain) {
46
+ this.path = path;
47
+ this.toolchain = (0, cargo_1.cargoToolchainArg)(toolchain);
48
+ }
49
+ static async getOrInstall(options) {
50
+ try {
51
+ return await Cross.get(options?.toolchain);
52
+ }
53
+ catch (error) {
54
+ core.debug(error.message);
55
+ return await Cross.install(options);
56
+ }
57
+ }
58
+ static async get(toolchain) {
59
+ const path = await io.which('cross', true);
60
+ return new Cross(path, toolchain);
61
+ }
62
+ static async install(options) {
63
+ const cargo = await cargo_1.Cargo.get();
64
+ const cwd = process.cwd();
65
+ process.chdir(os.tmpdir());
66
+ try {
67
+ const crossPath = await cargo.install('cross', options?.version, options?.primaryKey, options?.restoreKeys);
68
+ return new Cross(crossPath, options?.toolchain);
69
+ }
70
+ finally {
71
+ process.chdir(cwd);
72
+ core.endGroup();
73
+ }
74
+ }
75
+ async call(args, options) {
76
+ return await exec.exec(this.path, this.callArgs(args), options);
77
+ }
78
+ callArgs(args) {
79
+ return this.toolchain ? [this.toolchain, ...args] : args;
80
+ }
81
+ }
82
+ exports.Cross = Cross;
83
+ //# sourceMappingURL=cross.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross.js","sourceRoot":"","sources":["../../src/commands/cross.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAkC;AAClC,oDAAsC;AACtC,oDAAsC;AAEtC,mCAAmD;AAuCnD,MAAa,KAAK;IACC,IAAI,CAAS;IACb,SAAS,CAAS;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AAI,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IAKM,KAAK,CAAC,IAAI,CACf,IAAc,EACd,OAA0B;QAE1B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAEO,QAAQ,CAAC,IAAc;QAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;CACF;AA/ED,sBA+EC"}
@@ -0,0 +1,29 @@
1
+ import * as exec from '@actions/exec';
2
+ type Profile = 'minimal' | 'default' | 'full';
3
+ export interface ToolchainOptions {
4
+ default?: boolean;
5
+ override?: boolean;
6
+ components?: string[];
7
+ noSelfUpdate?: boolean;
8
+ allowDowngrade?: boolean;
9
+ force?: boolean;
10
+ }
11
+ export declare class RustUp {
12
+ private readonly path;
13
+ private constructor();
14
+ static getOrInstall(): Promise<RustUp>;
15
+ static get(): Promise<RustUp>;
16
+ static install(): Promise<RustUp>;
17
+ installToolchain(name: string, options?: ToolchainOptions): Promise<number>;
18
+ addTarget(name: string, forToolchain?: string): Promise<number>;
19
+ activeToolchain(): Promise<string>;
20
+ supportProfiles(): Promise<boolean>;
21
+ supportComponents(): Promise<boolean>;
22
+ setProfile(name: Profile): Promise<number>;
23
+ version(): Promise<string>;
24
+ which(program: string): Promise<string>;
25
+ selfUpdate(): Promise<number>;
26
+ call(args: string[], options?: exec.ExecOptions): Promise<number>;
27
+ callStdout(args: string[], options?: exec.ExecOptions): Promise<string>;
28
+ }
29
+ export {};
@@ -0,0 +1,201 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.RustUp = void 0;
37
+ const fs_1 = require("fs");
38
+ const path = __importStar(require("path"));
39
+ const process = __importStar(require("process"));
40
+ const semver = __importStar(require("semver"));
41
+ const io = __importStar(require("@actions/io"));
42
+ const core = __importStar(require("@actions/core"));
43
+ const exec = __importStar(require("@actions/exec"));
44
+ const tc = __importStar(require("@actions/tool-cache"));
45
+ const PROFILES_MIN_VERSION = '1.20.1';
46
+ const COMPONENTS_MIN_VERSION = '1.20.1';
47
+ class RustUp {
48
+ path;
49
+ constructor(exePath) {
50
+ this.path = exePath;
51
+ }
52
+ static async getOrInstall() {
53
+ try {
54
+ return await RustUp.get();
55
+ }
56
+ catch (error) {
57
+ core.debug(`Unable to find "rustup" executable, installing it now. Reason: ${error.message}`);
58
+ return await RustUp.install();
59
+ }
60
+ }
61
+ static async get() {
62
+ const exePath = await io.which('rustup', true);
63
+ return new RustUp(exePath);
64
+ }
65
+ static async install() {
66
+ const args = [
67
+ '--default-toolchain',
68
+ 'none',
69
+ '-y',
70
+ ];
71
+ switch (process.platform) {
72
+ case 'darwin':
73
+ case 'linux': {
74
+ const rustupSh = await tc.downloadTool('https://sh.rustup.rs');
75
+ core.debug(`Executing chmod 755 on the ${rustupSh}`);
76
+ await fs_1.promises.chmod(rustupSh, 0o755);
77
+ await exec.exec(rustupSh, args);
78
+ break;
79
+ }
80
+ case 'win32': {
81
+ const rustupExe = await tc.downloadTool('https://win.rustup.rs');
82
+ await exec.exec(rustupExe, args);
83
+ break;
84
+ }
85
+ default:
86
+ throw new Error(`Unknown platform ${process.platform}, can't install rustup`);
87
+ }
88
+ core.addPath(path.join(process.env.HOME, '.cargo', 'bin'));
89
+ return new RustUp('rustup');
90
+ }
91
+ async installToolchain(name, options) {
92
+ const args = ['toolchain', 'install', name];
93
+ if (options) {
94
+ if (options.components && options.components.length > 0) {
95
+ for (const component of options.components) {
96
+ args.push('--component');
97
+ args.push(component);
98
+ }
99
+ }
100
+ if (options.noSelfUpdate) {
101
+ args.push('--no-self-update');
102
+ }
103
+ if (options.allowDowngrade) {
104
+ args.push('--allow-downgrade');
105
+ }
106
+ if (options.force) {
107
+ args.push('--force');
108
+ }
109
+ }
110
+ await this.call(args);
111
+ if (options) {
112
+ if (options.default) {
113
+ await this.call(['default', name]);
114
+ }
115
+ if (options.override) {
116
+ await this.call(['override', 'set', name]);
117
+ }
118
+ }
119
+ return 0;
120
+ }
121
+ async addTarget(name, forToolchain) {
122
+ const args = ['target', 'add'];
123
+ if (forToolchain) {
124
+ args.push('--toolchain');
125
+ args.push(forToolchain);
126
+ }
127
+ args.push(name);
128
+ return await this.call(args);
129
+ }
130
+ async activeToolchain() {
131
+ const stdout = await this.callStdout(['show', 'active-toolchain']);
132
+ if (stdout) {
133
+ return stdout.split(' ', 2)[0];
134
+ }
135
+ else {
136
+ throw new Error('Unable to determine active toolchain');
137
+ }
138
+ }
139
+ async supportProfiles() {
140
+ const version = await this.version();
141
+ const supports = semver.gte(version, PROFILES_MIN_VERSION);
142
+ if (supports) {
143
+ core.info(`Installed rustup ${version} support profiles`);
144
+ }
145
+ else {
146
+ core.info(`Installed rustup ${version} does not support profiles, \
147
+ expected at least ${PROFILES_MIN_VERSION}`);
148
+ }
149
+ return supports;
150
+ }
151
+ async supportComponents() {
152
+ const version = await this.version();
153
+ const supports = semver.gte(version, COMPONENTS_MIN_VERSION);
154
+ if (supports) {
155
+ core.info(`Installed rustup ${version} support components`);
156
+ }
157
+ else {
158
+ core.info(`Installed rustup ${version} does not support components, \
159
+ expected at least ${PROFILES_MIN_VERSION}`);
160
+ }
161
+ return supports;
162
+ }
163
+ async setProfile(name) {
164
+ return await this.call(['set', 'profile', name]);
165
+ }
166
+ async version() {
167
+ const stdout = await this.callStdout(['-V']);
168
+ return stdout.split(' ')[1];
169
+ }
170
+ async which(program) {
171
+ const stdout = await this.callStdout(['which', program]);
172
+ if (stdout) {
173
+ return stdout;
174
+ }
175
+ else {
176
+ throw new Error(`Unable to find the ${program}`);
177
+ }
178
+ }
179
+ async selfUpdate() {
180
+ return await this.call(['self', 'update']);
181
+ }
182
+ async call(args, options) {
183
+ return await exec.exec(this.path, args, options);
184
+ }
185
+ async callStdout(args, options) {
186
+ let stdout = '';
187
+ const resOptions = {
188
+ ...options,
189
+ };
190
+ resOptions.listeners = {
191
+ ...options?.listeners,
192
+ stdout: (buffer) => {
193
+ stdout += buffer.toString();
194
+ },
195
+ };
196
+ await this.call(args, resOptions);
197
+ return stdout;
198
+ }
199
+ }
200
+ exports.RustUp = RustUp;
201
+ //# sourceMappingURL=rustup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rustup.js","sourceRoot":"","sources":["../../src/commands/rustup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAoC;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C,CAAC,CAAC;QAEzD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU;QACrB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,IAAI,CACf,IAAc,EACd,OAA0B;QAE1B,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAKD,KAAK,CAAC,UAAU,CACd,IAAc,EACd,OAA0B;QAE1B,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,UAAU,GAAqB;YACnC,GAAG,OAAO;SACX,CAAC;QACF,UAAU,CAAC,SAAS,GAAG;YACrB,GAAG,OAAO,EAAE,SAAS;YACrB,MAAM,EAAE,CAAC,MAAc,EAAQ,EAAE;gBAC/B,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC9B,CAAC;SACF,CAAC;QAEF,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAElC,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAzND,wBAyNC"}
package/dist/core.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './commands/cargo';
2
+ export * from './commands/cross';
3
+ export * from './commands/cargoHack';
4
+ export * from './commands/rustup';
5
+ import * as input from './input';
6
+ import * as checks from './checks';
7
+ import * as annotations from './annotations';
8
+ export { input, checks, annotations };
package/dist/core.js ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.annotations = exports.checks = exports.input = void 0;
40
+ __exportStar(require("./commands/cargo"), exports);
41
+ __exportStar(require("./commands/cross"), exports);
42
+ __exportStar(require("./commands/cargoHack"), exports);
43
+ __exportStar(require("./commands/rustup"), exports);
44
+ const input = __importStar(require("./input"));
45
+ exports.input = input;
46
+ const checks = __importStar(require("./checks"));
47
+ exports.checks = checks;
48
+ const annotations = __importStar(require("./annotations"));
49
+ exports.annotations = annotations;
50
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,uDAAqC;AACrC,oDAAkC;AAElC,+CAAiC;AAKxB,sBAAK;AAJd,iDAAmC;AAInB,wBAAM;AAHtB,2DAA6C;AAGrB,kCAAW"}
@@ -0,0 +1,5 @@
1
+ import * as core from '@actions/core';
2
+ export declare function getInput(name: string, options?: core.InputOptions): string;
3
+ export declare function getInputBool(name: string, options?: core.InputOptions): boolean;
4
+ export declare function getInputList(name: string, options?: core.InputOptions): string[];
5
+ export declare function getInputAsArray(name: string, options?: core.InputOptions): string[];
package/dist/input.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getInput = getInput;
37
+ exports.getInputBool = getInputBool;
38
+ exports.getInputList = getInputList;
39
+ exports.getInputAsArray = getInputAsArray;
40
+ const core = __importStar(require("@actions/core"));
41
+ function getInput(name, options) {
42
+ const inputFullName = name.replace(/-/g, '_');
43
+ const value = core.getInput(inputFullName, options);
44
+ if (value.length > 0) {
45
+ return value;
46
+ }
47
+ return core.getInput(name, options);
48
+ }
49
+ function getInputBool(name, options) {
50
+ const value = getInput(name, options);
51
+ if (value && (value === 'true' || value === '1')) {
52
+ return true;
53
+ }
54
+ else {
55
+ return false;
56
+ }
57
+ }
58
+ function getInputList(name, options) {
59
+ const raw = getInput(name, options);
60
+ return raw
61
+ .split(',')
62
+ .map((item) => item.trim())
63
+ .filter((item) => item.length > 0);
64
+ }
65
+ function getInputAsArray(name, options) {
66
+ return getInput(name, options)
67
+ .split('\n')
68
+ .map((s) => s.trim())
69
+ .filter((x) => x !== '');
70
+ }
71
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../src/input.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,4BAQC;AAED,oCAUC;AAED,oCAUC;AAED,0CAQC;AApDD,oDAAsC;AAUtC,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAA2B;IAChE,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACpD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,SAAgB,YAAY,CAC1B,IAAY,EACZ,OAA2B;IAE3B,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,KAAK,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAgB,YAAY,CAC1B,IAAY,EACZ,OAA2B;IAE3B,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEpC,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,eAAe,CAC7B,IAAY,EACZ,OAA2B;IAE3B,OAAO,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;SAC3B,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "private": false,
3
+ "name": "@clechasseur/rs-actions-core",
4
+ "version": "6.0.0",
5
+ "author": "clechasseur",
6
+ "license": "MIT",
7
+ "description": "Core functionality for the rs-* actions repos",
8
+ "main": "dist/core.js",
9
+ "files": [
10
+ "dist/**/*.js",
11
+ "dist/**/*.js.map",
12
+ "dist/**/*.d.ts"
13
+ ],
14
+ "scripts": {
15
+ "all": "npm run refresh && npm run lint && npm test",
16
+ "build": "tsc -p .",
17
+ "format": "prettier --write 'src/**/*.ts' '__tests__/**/*.ts'",
18
+ "lint": "oxlint",
19
+ "refresh": "rm -rf ./dist/* && npm run build",
20
+ "test": "jest -c jest.config.json --runInBand"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/clechasseur/rs-actions-core.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/clechasseur/rs-actions-core/issues"
28
+ },
29
+ "engines": {
30
+ "node": ">=24.0.0"
31
+ },
32
+ "dependencies": {
33
+ "@actions/cache": "^4.0.5",
34
+ "@actions/core": "^1.11.1",
35
+ "@actions/exec": "^1.1.1",
36
+ "@actions/github": "^6.0.1",
37
+ "@actions/http-client": "^2.2.3",
38
+ "@actions/io": "^1.1.3",
39
+ "@actions/tool-cache": "^2.0.2",
40
+ "semver": "^7.7.2"
41
+ },
42
+ "devDependencies": {
43
+ "@types/jest": "^30.0.0",
44
+ "@types/node": "^24.3.0",
45
+ "@types/semver": "^7.7.0",
46
+ "jest": "^30.1.1",
47
+ "oxlint": "^1.13.0",
48
+ "prettier": "^3.6.2",
49
+ "ts-jest": "^29.4.1",
50
+ "typescript": "^5.9.2"
51
+ }
52
+ }