Skip to content

Commit

Permalink
Add expiry info to env along with token (#11)
Browse files Browse the repository at this point in the history
* Add expiry info to env along with token

* Use aio app build instead of aio app deploy --skip-deploy for build
  • Loading branch information
sandeep-paliwal authored Aug 16, 2021
1 parent 454d2bc commit 76e7c2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ const os = core.getInput('os');

let commandStr = []
if(command.toLowerCase() === 'build') {
commandStr.push("aio app deploy --skip-deploy")
commandStr.push("aio app build")
}
else if(command.toLowerCase() === 'deploy') {
let deployCmd = 'aio app deploy --skip-build'
Expand Down Expand Up @@ -1287,9 +1287,11 @@ function generateAuthToken() {
.then(res => {
console.log('Generated auth token successfully')
//set token to be used by CLI
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN', res)
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_TOKEN', res)
//mask the env var for logging
core.setSecret('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN')
core.setSecret('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_TOKEN')
const expiry = Date.now() + 30 * 60 * 1000 //30 mins from current time
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_EXPIRY', expiry)
})
.catch(e => {
core.setFailed(e.message)
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const os = core.getInput('os');

let commandStr = []
if(command.toLowerCase() === 'build') {
commandStr.push("aio app deploy --skip-deploy")
commandStr.push("aio app build")
}
else if(command.toLowerCase() === 'deploy') {
let deployCmd = 'aio app deploy --skip-build'
Expand Down Expand Up @@ -93,9 +93,11 @@ function generateAuthToken() {
.then(res => {
console.log('Generated auth token successfully')
//set token to be used by CLI
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN', res)
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_TOKEN', res)
//mask the env var for logging
core.setSecret('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN')
core.setSecret('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_TOKEN')
const expiry = Date.now() + 30 * 60 * 1000 //30 mins from current time
core.exportVariable('AIO_IMS_CONTEXTS_CLI_ACCESS__TOKEN_EXPIRY', expiry)
})
.catch(e => {
core.setFailed(e.message)
Expand Down

0 comments on commit 76e7c2b

Please sign in to comment.