From d41fccdd9e8fb268f5976e0b6ab455cd5d60e380 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 26 Jul 2024 16:53:16 -0400 Subject: [PATCH] Log in to flakehub for 'fh' too (#110) --- .github/workflows/ci.yml | 12 ------------ dist/index.js | 5 +++++ src/index.ts | 9 ++++++++- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3eaa48..78054af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,12 +128,6 @@ jobs: cat -n /etc/nix/nix.conf grep -E "^trusted-users = .*$USER" /etc/nix/nix.conf grep -E "^use-sqlite-wal = true" /etc/nix/nix.conf - - name: Breakpoint if tests failed - if: failure() - uses: namespacelabs/breakpoint-action@v0 - with: - duration: 5m - authorized-users: grahamc install-nix-macos: name: Run test suite for macOS systems @@ -217,12 +211,6 @@ jobs: cat /etc/nix/nix.conf grep -E "^trusted-users = .*$USER" /etc/nix/nix.conf grep -E "^use-sqlite-wal = true" /etc/nix/nix.conf - - name: Breakpoint if tests failed - if: failure() - uses: namespacelabs/breakpoint-action@v0 - with: - duration: 5m - authorized-users: grahamc install-with-non-default-source-inputs: name: Install Nix using non-default source-${{ matrix.inputs.key }} diff --git a/dist/index.js b/dist/index.js index 7672c99..fb8ee25 100644 --- a/dist/index.js +++ b/dist/index.js @@ -102316,9 +102316,14 @@ ${stderrBuffer}` netrcPath, [ `machine api.flakehub.com login flakehub password ${jwt}`, + `machine cache.flakehub.com login flakehub password ${jwt}`, `machine flakehub.com login flakehub password ${jwt}` ].join("\n") ); + const flakehubAuthDir = `${process.env["XDG_CONFIG_HOME"] || `${process.env["HOME"]}/.config`}/flakehub`; + await (0,promises_namespaceObject.mkdir)(flakehubAuthDir, { recursive: true }); + const flakehubAuthPath = `${flakehubAuthDir}/auth`; + await (0,promises_namespaceObject.writeFile)(flakehubAuthPath, jwt); core.info("Logging in to FlakeHub."); if (this.extraConf?.join("\n").match(/^netrc-file/m)) { core.warning( diff --git a/src/index.ts b/src/index.ts index 59313bf..748c277 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import * as actionsCore from "@actions/core"; import * as github from "@actions/github"; import * as actionsExec from "@actions/exec"; -import { access, writeFile, readFile } from "node:fs/promises"; +import { access, writeFile, readFile, mkdir } from "node:fs/promises"; import { join } from "node:path"; import fs from "node:fs"; import { userInfo } from "node:os"; @@ -854,10 +854,17 @@ class NixInstallerAction extends DetSysAction { netrcPath, [ `machine api.flakehub.com login flakehub password ${jwt}`, + `machine cache.flakehub.com login flakehub password ${jwt}`, `machine flakehub.com login flakehub password ${jwt}`, ].join("\n"), ); + const flakehubAuthDir = `${process.env["XDG_CONFIG_HOME"] || `${process.env["HOME"]}/.config`}/flakehub`; + await mkdir(flakehubAuthDir, { recursive: true }); + const flakehubAuthPath = `${flakehubAuthDir}/auth`; + + await writeFile(flakehubAuthPath, jwt); + actionsCore.info("Logging in to FlakeHub."); // the join followed by a match on ^... looks silly, but extra_config