Skip to content

Commit

Permalink
Check the userInfo.username instead of an env var
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc committed Dec 4, 2023
1 parent 648b3f2 commit 8f4a865
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
27 changes: 22 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { chmod, access, writeFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";
import { join } from "node:path";
import fs from "node:fs";
import { userInfo } from "node:os";
import stringArgv from "string-argv";
import * as path from "path";

Expand Down Expand Up @@ -294,7 +295,12 @@ class NixInstallerAction {
extra_conf += "\n";
}
if (this.trust_runner_user !== null) {
extra_conf += `trusted-users = root ${process.env.USER}`;
const user = userInfo().username;
if (user) {
extra_conf += `trusted-users = root ${user}`;
} else {
extra_conf += `trusted-users = root`;
}
extra_conf += "\n";
}
if (this.flakehub) {
Expand Down

0 comments on commit 8f4a865

Please sign in to comment.