From 72c0bfd31ab22a2e11716951e3f107a9647dc97e Mon Sep 17 00:00:00 2001 From: Jano Paetzold Date: Wed, 8 Jan 2025 18:58:23 +0100 Subject: [PATCH] Improve documentation on why we use os.userInfo() (use correct syscall name) Co-authored-by: Matthias Pigulla --- paths.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/paths.js b/paths.js index bd4cd30..f440579 100644 --- a/paths.js +++ b/paths.js @@ -2,8 +2,9 @@ const os = require('os'); const core = require('@actions/core'); const defaults = (process.env['OS'] != 'Windows_NT') ? { - // Use getent() system call, since this is what ssh does; makes a difference in Docker-based - // Action runs, where $HOME is different from the pwent + // We use os.userInfo() rather than os.homedir(), since it uses the getpwuid() system call to get the user's home directory (see https://nodejs.org/api/os.html#osuserinfooptions). + // This mimics the way openssh derives the home directory for locating config files (see https://github.com/openssh/openssh-portable/blob/826483d51a9fee60703298bbf839d9ce37943474/ssh.c#L710); + // Makes a difference in Docker-based Action runs, when $HOME is different from what getpwuid() returns (which is based on the entry in /etc/passwd) homePath: os.userInfo().homedir, sshAgentCmdDefault: 'ssh-agent', sshAddCmdDefault: 'ssh-add',