I am using github secrets in a bash script but it wont work #2014
Replies: 1 comment
-
|
When you write In your case, the secret is available, but the generated command appears to be parsed as multiple arguments: aws s3 sync services/my_artifact_1/builds/ *** /outputs/...That makes the AWS CLI receive the destination as separate arguments, which matches the A safer pattern is to pass the values through - name: Copy files to s3
shell: bash
env:
S3_PREFIX: ${{ inputs.s3_release_url }}
SERVICE_NAME: ${{ inputs.service_name }}
VERSION: ${{ inputs.version }}
run: |
mkdir -p "services/${SERVICE_NAME}/builds"
touch "services/${SERVICE_NAME}/builds/example.txt"
aws s3 sync "services/${SERVICE_NAME}/builds/" \
"${S3_PREFIX}/releases/${VERSION}"This keeps the expression value out of the generated shell script text and lets Bash receive it as an environment variable instead. Quoting the variables also prevents word splitting in the final |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a github workflow where I am accessing a secret
S3_URLfrom GitHub secrets and consuming it in workflow like belowand in my caller workflow
I am getting the following error
The error is happening due to
secrets.S3_URLaccessibility.How can I access
secrets.S3_URLin. mycompositeaction properly in the bash script.I have tried to print my command to a file as follows, it works when I echoed it (I know this is bad practice, tried this as last resort to know whether the
S3_URLis accessible in my composite action or not. It echoed output as expectedCould someone help me?
Thanks in Advance 🙏
Beta Was this translation helpful? Give feedback.
All reactions