diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml deleted file mode 100644 index 944ad0a..0000000 --- a/.github/workflows/compile.yml +++ /dev/null @@ -1,10 +0,0 @@ -on: [push, pull_request] - -jobs: - compile: - runs-on: windows-latest - steps: - - uses: actions/checkout@v2 - - run: | - cl test.c - test diff --git a/.github/workflows/demo.yml-disabled b/.github/workflows/demo.yml similarity index 100% rename from .github/workflows/demo.yml-disabled rename to .github/workflows/demo.yml diff --git a/askpass.exe b/askpass.exe new file mode 100755 index 0000000..631d3db Binary files /dev/null and b/askpass.exe differ diff --git a/dist/index.js b/dist/index.js index 2425967..ce90adc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -179,8 +179,6 @@ try { console.log(`Write file ${keyFile}`); fs.writeFileSync(keyFile, key.replace("\r\n", "\n").trim() + "\n", { mode: '600' }); - fs.writeFileSync(`${homeSsh}/askpass`, `echo ${token}`, { mode: '700' }); - // Set private key passphrase let output = ''; try { @@ -193,23 +191,17 @@ try { } // Load key into agent - console.log('Load key'); - //let sshAdd = child_process.execSync(`echo "${token}" | ssh-add "${keyFile}"`, { stdio: 'inherit' }); var sshAdd; try { - let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'SSH_ASKPASS': `${homeSsh}/askpass` } }); + let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'askpass' } }); } catch (exception) { - console.log(sshAdd); + console.log(sshAdd.toString()); console.log(exception); throw exception; } console.log(sshAdd); - // input: token + "\n", stdio: ['pipe', 'inherit', 'inherit'] }); - //sshAdd.stdin.write(token + "\n"); - //sshAdd.stdin.end(); - output.toString().split(/\r?\n/).forEach(function(key) { let parts = key.match(/^Key has comment '.*\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+?)(?=\.git|\s|\')/); diff --git a/index.js b/index.js index 4fae763..b99bb8c 100644 --- a/index.js +++ b/index.js @@ -62,8 +62,6 @@ try { console.log(`Write file ${keyFile}`); fs.writeFileSync(keyFile, key.replace("\r\n", "\n").trim() + "\n", { mode: '600' }); - fs.writeFileSync(`${homeSsh}/askpass`, `echo ${token}`, { mode: '700' }); - // Set private key passphrase let output = ''; try { @@ -76,23 +74,17 @@ try { } // Load key into agent - console.log('Load key'); - //let sshAdd = child_process.execSync(`echo "${token}" | ssh-add "${keyFile}"`, { stdio: 'inherit' }); var sshAdd; try { - let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'SSH_ASKPASS': `${homeSsh}/askpass` } }); + let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'askpass' } }); } catch (exception) { - console.log(sshAdd); + console.log(sshAdd.toString()); console.log(exception); throw exception; } console.log(sshAdd); - // input: token + "\n", stdio: ['pipe', 'inherit', 'inherit'] }); - //sshAdd.stdin.write(token + "\n"); - //sshAdd.stdin.end(); - output.toString().split(/\r?\n/).forEach(function(key) { let parts = key.match(/^Key has comment '.*\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+?)(?=\.git|\s|\')/);