Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
use env
Browse files Browse the repository at this point in the history
see actions/github-script#287

chore: change variable names
  • Loading branch information
v1v committed Nov 7, 2023
1 parent 8f5ff0b commit 252447f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
17 changes: 10 additions & 7 deletions .github/actions/oblt-cli-cluster-credentials/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ runs:
CLUSTER_INFO_FILE_INPUT: ${{ inputs.cluster-info-file }}
with:
script: |
const clusterName = process.env.CLUSTER_NAME_INPUT
const clusterNameInput = process.env.CLUSTER_NAME_INPUT
const clusterInfoFile = process.env.CLUSTER_INFO_FILE_INPUT
console.log(`clusterName is "${clusterName}"`)
console.log(`clusterName is "${clusterNameInput}"`)
console.log(`clusterInfoFile is "${clusterInfoFile}"`)
if (clusterName && clusterInfoFile) {
if (clusterNameInput && clusterInfoFile) {
core.setFailed(`Either cluster-name or cluster-info-file but no both`)
}
var cluster = clusterName
var clusterName = clusterNameInput
if (clusterInfoFile) {
const fs = require('fs')
Expand All @@ -50,13 +51,15 @@ runs:
if (jsonObject && jsonObject.ClusterName === undefined) {
core.setFailed(`cluster-info-file does not contain the field ClusterName`)
}
cluster = jsonObject.ClusterName
clusterName = jsonObject.ClusterName
}
if (cluster.trim().length === 0) {
if (clusterName.trim().length === 0) {
core.setFailed(`cluster name is empty`)
}
core.exportVariable('CLUSTER_NAME', `${cluster}`)
console.log(`clusterName is "${clusterName}"`)
core.exportVariable('CLUSTER_NAME', `${clusterName}`)
- uses: elastic/apm-pipeline-library/.github/actions/setup-oblt-cli@current
with:
Expand Down
19 changes: 12 additions & 7 deletions .github/actions/oblt-cli-destroy-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ runs:
steps:
- name: Process inputs
uses: actions/github-script@v6
env:
CLUSTER_NAME_INPUT: ${{ inputs.cluster-name }}
CLUSTER_INFO_FILE_INPUT: ${{ inputs.cluster-info-file }}
with:
script: |
const clusterName = core.getInput('cluster-name')
const clusterInfoFile = core.getInput('cluster-info-file')
const clusterNameInput = process.env.CLUSTER_NAME_INPUT
const clusterInfoFile = process.env.CLUSTER_INFO_FILE_INPUT
if (clusterName && clusterInfoFile) {
if (clusterNameInput && clusterInfoFile) {
core.setFailed(`Either cluster-name or cluster-info-file but no both`)
}
var cluster = clusterName
var clusterName = clusterNameInput
if (clusterInfoFile) {
const fs = require('fs')
Expand All @@ -33,13 +36,15 @@ runs:
if (jsonObject && jsonObject.ClusterName === undefined) {
core.setFailed(`cluster-info-file does not contain the field ClusterName`)
}
cluster = jsonObject.ClusterName
clusterName = jsonObject.ClusterName
}
if (cluster.trim().length === 0) {
if (clusterName.trim().length === 0) {
core.setFailed(`cluster name is empty`)
}
core.exportVariable('CLUSTER_NAME', `${cluster}`)
console.log(`clusterName is "${clusterName}"`)
core.exportVariable('CLUSTER_NAME', `${clusterName}`)
- uses: elastic/apm-pipeline-library/.github/actions/oblt-cli@current
with:
Expand Down

0 comments on commit 252447f

Please sign in to comment.