Skip to content

Commit

Permalink
test 13
Browse files Browse the repository at this point in the history
  • Loading branch information
jcpitre committed Nov 7, 2024
1 parent b954e35 commit aa48bf2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
19 changes: 9 additions & 10 deletions .github/actions/extract-1password-secret/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: 'Extract Value'
description: 'Extracts the value for a given key from a GitHub variable'
inputs:
keys:
VARIABLES_TO_EXTRACT:
description: 'A list of space separated keys to extract'
required: true
type: string
# ONE_PASSWORD_SECRET_REFERENCES:
# description: 'The contents of the ONE_PASSWORD_SECRET_REFERENCES variable'
# required: true
# type: string
ONE_PASSWORD_SECRET_REFERENCES:
description: 'The contents of the ONE_PASSWORD_SECRET_REFERENCES variable'
required: true
type: string
OP_SERVICE_ACCOUNT_TOKEN:
description: 'The 1Password service account token'
required: true
Expand All @@ -21,14 +21,13 @@ runs:
id: extract_value
shell: bash
continue-on-error: true
env:
# key_values: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}
qaz: ${{ secrets.GCP_WEB_VALIDATOR_SA_KEY }}
# env:
# key_values: ${{ inputs.ONE_PASSWORD_SECRET_REFERENCES }}
run: |
keys=$(echo "${{ inputs.keys }}" | tr ',' ' ')
keys=$(echo "${{ inputs.VARIABLES_TO_EXTRACT }}" | tr ',' ' ')
for key in $keys; do
variable_name=$(echo "$key" | sed 's/^ *//;s/ *$//')
value=$(echo "$key_values" | grep "^$variable_name *=" | cut -d'=' -f2- | sed 's/^ *//;s/[ \r]*$//')
value=$(echo "${{ inputs.ONE_PASSWORD_SECRET_REFERENCES }}" | grep "^$variable_name *=" | cut -d'=' -f2- | sed 's/^ *//;s/[ \r]*$//')
echo "value = $value"
echo "variable_name = $variable_name"
echo "$variable_name=$value" >> $GITHUB_ENV
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/secret_refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

jobs:
my-job2:
secrets: inherit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -17,8 +16,8 @@ jobs:
uses: ./.github/actions/extract-1password-secret
with:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} # This is required to connect to the vault in our 1Password account.
keys: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, GITHUB_GENERIC_ACTION_CREDENTIALS, qaz'
# ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}
VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, GITHUB_GENERIC_ACTION_CREDENTIALS, qaz'
ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}

- name: Use extracted value
run: |
Expand Down

0 comments on commit aa48bf2

Please sign in to comment.