Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ try {
console.log('Configuring deployment key(s)');

child_process.execFileSync(sshAdd, ['-L']).toString().split(/\r?\n/).forEach(function(key) {
const parts = key.match(/\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)/);
var lowerCaseKey = key.ToLowerCase();
const parts = lowerCaseKey.match(/\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+)/);

if (!parts) {
return;
}

const sha256 = crypto.createHash('sha256').update(key).digest('hex');
const sha256 = crypto.createHash('sha256').update(lowerCaseKey).digest('hex');
const ownerAndRepo = parts[1].replace(/\.git$/, '');

fs.writeFileSync(`${homeSsh}/key-${sha256}`, key + "\n", { mode: '600' });
fs.writeFileSync(`${homeSsh}/key-${sha256}`, lowerCaseKey + "\n", { mode: '600' });

child_process.execSync(`git config --global --replace-all url."git@key-${sha256}.github.202132.xyz:${ownerAndRepo}".insteadOf "https://github.com/${ownerAndRepo}"`);
child_process.execSync(`git config --global --add url."git@key-${sha256}.github.202132.xyz:${ownerAndRepo}".insteadOf "[email protected]:${ownerAndRepo}"`);
Expand Down