-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e926631
commit 3ff74a3
Showing
8 changed files
with
236 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: 'test' | ||
inputs: | ||
json: | ||
required: true | ||
outputs: | ||
out: | ||
description: 'The time we greeted you' | ||
runs: | ||
using: 'node16' | ||
main: './scripts/parse.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"x": 1, | ||
"y": "q\nux" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// const core = require('@actions/core'); | ||
|
||
try { | ||
let inputs = [ | ||
process.env.JSONSTRING, | ||
process.env.JSONSTRINGMULTILINE, | ||
process.env.JSONDATA, | ||
process.env.SINGLELINE, | ||
process.env.MULTILINE, | ||
]; | ||
|
||
let names = [ | ||
"test-json-string", | ||
"test-json-string-multiline", | ||
"test-json-data", | ||
"singleline", | ||
"multiline", | ||
]; | ||
|
||
let i = 0; | ||
inputs.forEach(input => { | ||
console.log(`processing: ${names[i]}`) | ||
i++; | ||
input = (input || '').trim(); | ||
if (!input) { | ||
throw new Error(`Missing service account key JSON (got empty value)`); | ||
} | ||
|
||
// If the string doesn't start with a JSON object character, it is probably | ||
// base64-encoded. | ||
if (!input.startsWith('{')) { | ||
let str = input.replace(/-/g, '+').replace(/_/g, '/'); | ||
while (str.length % 4) str += '='; | ||
input = Buffer.from(str, 'base64').toString('utf8'); | ||
} | ||
|
||
try { | ||
const creds = JSON.parse(input); | ||
console.log('success!') | ||
return creds; | ||
} catch (err) { | ||
console.log('error parsing') | ||
console.log(err) | ||
} | ||
}) | ||
|
||
} catch (error) { | ||
console.log(error) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,4 +66,4 @@ describe('exportSecrets retries', () => { | |
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters