@tahminator/pipeline 1.0.60 → 1.0.61-beta.4169dd2f

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.
@@ -17,6 +17,9 @@ export class EnvClient {
17
17
  return this.maskAndReturnEnv(await this.strategy.readFromEnv(fileName, opts));
18
18
  }
19
19
  maskAndReturnEnv(envs) {
20
+ if (process.env.CI !== "true") {
21
+ return Object.fromEntries(envs);
22
+ }
20
23
  for (const [varName, value] of envs.entries()) {
21
24
  if (value === "true" || value === "false" || value === "") {
22
25
  console.log(`Not masking ${varName}: true/false/empty value`);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import { appendFile } from "node:fs/promises";
2
+ async function main() {
3
+ const githubEnvLoc = process.env.GITHUB_ENV;
4
+ if (!githubEnvLoc) {
5
+ throw new Error("GITHUB_ENV is missing from environment");
6
+ }
7
+ const secretsJson = process.env.SECRETS;
8
+ if (!secretsJson) {
9
+ throw new Error("SECRETS is required and not defined");
10
+ }
11
+ for (const [k, _v] of Object.entries(JSON.parse(secretsJson))) {
12
+ const v = String(_v);
13
+ if (v === "true" || v === "false" || v === "") {
14
+ console.log(`Not masking ${k}: true/false/empty v`);
15
+ continue;
16
+ }
17
+ console.log(`Masking ${k}`);
18
+ const lines = v.split("\n");
19
+ if (lines.length == 1) {
20
+ console.log(`::add-mask::${v}`);
21
+ }
22
+ else {
23
+ for (const line of lines) {
24
+ if (!line.trim().length)
25
+ continue;
26
+ console.log(`::add-mask::${line}`);
27
+ }
28
+ }
29
+ if (lines.length === 1) {
30
+ await appendFile(githubEnvLoc, `${k}=${v}\n`);
31
+ }
32
+ else {
33
+ await appendFile(githubEnvLoc, `${k}<<__EOF__\n${v}\n__EOF__\n`);
34
+ }
35
+ }
36
+ }
37
+ void main();
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "author": "Tahmid Ahmed",
5
5
  "description": "A collection of Bun shell scripts that can be re-used in various CICD pipelines.",
6
- "version": "1.0.60",
6
+ "version": "1.0.61-beta.4169dd2f",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/tahminator/pipeline.git"
9
9
  },