From 2559635e738e815d85cf3716dface9191276ddd1 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Fri, 10 May 2024 11:48:39 +0200 Subject: [PATCH 1/2] Split input.repo to get only repo name. input.repo comes from github.repository which means owner/repo We only need the repo name for the Packages file. --- dist/publish-crates-debian-main.js | 4 +++- src/publish-crates-debian.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/publish-crates-debian-main.js b/dist/publish-crates-debian-main.js index c31ec75..cfade69 100644 --- a/dist/publish-crates-debian-main.js +++ b/dist/publish-crates-debian-main.js @@ -127723,8 +127723,10 @@ async function main(input) { (0,_command__WEBPACK_IMPORTED_MODULE_5__.sh)(`unzip ${archive} -d ${input.version}`); } } + // repo is actually owner/repo so we have to split it here to get only the git repo name + const gitRepo = input.repo.split("/")[1]; const debianRepo = `${input.sshHost}:${input.sshHostPath}`; - const packagesPath = `.Packages-${input.repo}-${input.version}`; + const packagesPath = `.Packages-${gitRepo}-${input.version}`; const allPackagesPath = "Packages"; const allPackagesGzippedPath = "Packages.gz"; await _ssh__WEBPACK_IMPORTED_MODULE_4__/* .withIdentity */ .Y(input.sshPrivateKey, input.sshPassphrase, env => { diff --git a/src/publish-crates-debian.ts b/src/publish-crates-debian.ts index f677eab..be28837 100644 --- a/src/publish-crates-debian.ts +++ b/src/publish-crates-debian.ts @@ -71,8 +71,10 @@ export async function main(input: Input) { } } + // repo is actually owner/repo so we have to split it here to get only the git repo name + const gitRepo = input.repo.split("/")[1] const debianRepo = `${input.sshHost}:${input.sshHostPath}`; - const packagesPath = `.Packages-${input.repo}-${input.version}`; + const packagesPath = `.Packages-${gitRepo}-${input.version}`; const allPackagesPath = "Packages"; const allPackagesGzippedPath = "Packages.gz"; From 382dcc39c84c0c73e4609914a46eb83139071c48 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Fri, 10 May 2024 11:53:30 +0200 Subject: [PATCH 2/2] npm format:check fixes --- src/publish-crates-debian.ts | 4 ++-- src/ssh.ts | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/publish-crates-debian.ts b/src/publish-crates-debian.ts index be28837..064c1fd 100644 --- a/src/publish-crates-debian.ts +++ b/src/publish-crates-debian.ts @@ -34,7 +34,7 @@ export function setup(): Input { const sshPrivateKey = core.getInput("ssh-private-key", { required: true }); const sshPassphrase = core.getInput("ssh-passphrase", { required: true }); const installationTest = core.getBooleanInput("installation-test", { required: true }); - const repo = core.getInput("repo", {required: true}); + const repo = core.getInput("repo", { required: true }); return { liveRun, @@ -72,7 +72,7 @@ export async function main(input: Input) { } // repo is actually owner/repo so we have to split it here to get only the git repo name - const gitRepo = input.repo.split("/")[1] + const gitRepo = input.repo.split("/")[1]; const debianRepo = `${input.sshHost}:${input.sshHostPath}`; const packagesPath = `.Packages-${gitRepo}-${input.version}`; const allPackagesPath = "Packages"; diff --git a/src/ssh.ts b/src/ssh.ts index 0b994a5..76f558e 100644 --- a/src/ssh.ts +++ b/src/ssh.ts @@ -7,11 +7,7 @@ function setupAgent(): NodeJS.ProcessEnv { return Object.fromEntries([...commands.matchAll(/([A-Z_]+)=([^;]+);/g)].map(m => [m[1], m[2]])); } -export async function withIdentity( - privateKey: string, - passphrase: string, - fn: (env: NodeJS.ProcessEnv) => void, -) { +export async function withIdentity(privateKey: string, passphrase: string, fn: (env: NodeJS.ProcessEnv) => void) { const env = setupAgent(); const passphrasePath = "./.ssh_askpass"; await fs.writeFile(passphrasePath, `echo '${passphrase}'`, { mode: fs.constants.S_IRWXU });