forked from nodejs/node-core-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-auth-github.js
More file actions
28 lines (26 loc) · 767 Bytes
/
run-auth-github.js
File metadata and controls
28 lines (26 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import assert from 'assert';
async function mockCredentials(options) {
assert.deepStrictEqual(options, {
noSave: true,
scopes: ['user:email', 'read:org'],
note: 'node-core-utils CLI tools',
noDeviceFlow: true
});
return {
user: 'nyancat',
token: '0123456789abcdef'
};
}
(async function() {
const { default: auth } = await import('../../lib/auth.js');
const authParams = await auth({ github: true }, mockCredentials);
if (typeof authParams === 'object' && authParams != null) {
for (const key of Object.getOwnPropertyNames(authParams)) {
if (key !== 'github') delete authParams[key];
}
}
process.stdout.write(`${JSON.stringify(authParams)}\n`);
})().catch(err => {
console.error(err);
process.exit(1);
});