Skip to content

Commit d521afd

Browse files
remove setup auth in aciton, use github vars and secrets instead
1 parent 3fcab73 commit d521afd

File tree

4 files changed

+5
-105
lines changed

4 files changed

+5
-105
lines changed

.github/workflows/set-up-stackql.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222

2323
- name: Setup stackql
2424
uses: ./
25-
with:
26-
authObjString: ${{ secrets.AUTH_OBJECT_STR }}
2725

2826

2927
- name: Validate Stackql Version
@@ -32,4 +30,7 @@ jobs:
3230
3331
- name: Use GitHub Provider
3432
run: |
35-
stackql exec -i ./examples/get-github-commits.iql --auth="${AUTH}"
33+
stackql exec -i ./examples/get-github-commits.iql --auth="${AUTH}"
34+
env:
35+
AUTH: ${{ vars.AUTH }}
36+
GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}

action.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: 'StackQL Studio - Setup StackQL'
22
description: 'Sets up StackQL CLI in your GitHub Actions workflow.'
33
author: 'Yuncheng Yang, StackQL'
4-
inputs:
5-
authObjString:
6-
description: 'The authentication object'
7-
required: true
4+
85

96
runs:
107
using: 'node16'

dist/index.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6748,61 +6748,12 @@ async function addPermission(){
67486748
}
67496749
}
67506750

6751-
async function setupAuth(){
6752-
/**
6753-
* AUTH='{ "google": { "credentialsfilepath": "creds/stackql-demo.json", "type": "service_account" },
6754-
* "okta": { "credentialsenvvar": "OKTA_SECRET_KEY", "type": "api_key", credentials: '<your credentials>' }}'
6755-
*/
6756-
/**
6757-
* expected auth obj
6758-
* {
6759-
* okta :{
6760-
* type: "api_key",
6761-
* credentialsenvvar: 'OKTA_SECRET_KEY',
6762-
* credentials: '<the credential>'
6763-
* }
6764-
* }
6765-
*/
6766-
6767-
/**
6768-
* When credentials envvar exist, set a env var in the action
6769-
* key = <value of credentialsenvvar in auth obj>
6770-
* value = <value of credentials in auth obj>
6771-
*/
6772-
const authObjString = core.getInput("authObjString");
6773-
try {
6774-
6775-
if(!authObjString || authObjString === "" ) {
6776-
throw Error ('Cannot find auth object string')
6777-
}
6778-
6779-
const authObj = JSON.parse(authObjString)
6780-
Object.keys(authObj).forEach(providerName =>{
6781-
const providerAuth = authObj[providerName]
6782-
if (providerAuth.credentialsenvvar && providerAuth.credentials) {
6783-
core.exportVariable(providerAuth.credentialsenvvar, providerAuth.credentials)
6784-
delete authObj[providerName]['credentials']
6785-
}
6786-
//TODO: if provider auth is a file
6787-
})
6788-
6789-
const stackqlAuthString = JSON.stringify(authObj)
6790-
core.info(`Setting AUTH string ${stackqlAuthString}` )
6791-
core.exportVariable('AUTH', stackqlAuthString)
6792-
6793-
} catch (error) {
6794-
throw Error(`Error when setup auth ${error}`)
6795-
}
6796-
6797-
}
6798-
67996751
async function setup(){
68006752

68016753
const path = await downloadCLI()
68026754

68036755
core.addPath(path)
68046756
await addPermission()
6805-
setupAuth()
68066757
}
68076758

68086759
(async () => {

index.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -46,61 +46,12 @@ async function addPermission(){
4646
}
4747
}
4848

49-
async function setupAuth(){
50-
/**
51-
* AUTH='{ "google": { "credentialsfilepath": "creds/stackql-demo.json", "type": "service_account" },
52-
* "okta": { "credentialsenvvar": "OKTA_SECRET_KEY", "type": "api_key", credentials: '<your credentials>' }}'
53-
*/
54-
/**
55-
* expected auth obj
56-
* {
57-
* okta :{
58-
* type: "api_key",
59-
* credentialsenvvar: 'OKTA_SECRET_KEY',
60-
* credentials: '<the credential>'
61-
* }
62-
* }
63-
*/
64-
65-
/**
66-
* When credentials envvar exist, set a env var in the action
67-
* key = <value of credentialsenvvar in auth obj>
68-
* value = <value of credentials in auth obj>
69-
*/
70-
const authObjString = core.getInput("authObjString");
71-
try {
72-
73-
if(!authObjString || authObjString === "" ) {
74-
throw Error ('Cannot find auth object string')
75-
}
76-
77-
const authObj = JSON.parse(authObjString)
78-
Object.keys(authObj).forEach(providerName =>{
79-
const providerAuth = authObj[providerName]
80-
if (providerAuth.credentialsenvvar && providerAuth.credentials) {
81-
core.exportVariable(providerAuth.credentialsenvvar, providerAuth.credentials)
82-
delete authObj[providerName]['credentials']
83-
}
84-
//TODO: if provider auth is a file
85-
})
86-
87-
const stackqlAuthString = JSON.stringify(authObj)
88-
core.info(`Setting AUTH string ${stackqlAuthString}` )
89-
core.exportVariable('AUTH', stackqlAuthString)
90-
91-
} catch (error) {
92-
throw Error(`Error when setup auth ${error}`)
93-
}
94-
95-
}
96-
9749
async function setup(){
9850

9951
const path = await downloadCLI()
10052

10153
core.addPath(path)
10254
await addPermission()
103-
setupAuth()
10455
}
10556

10657
(async () => {

0 commit comments

Comments
 (0)