This repository was archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Value altered when substitude value in yaml #40
Copy link
Copy link
Open
Labels
Description
How to reproduce
Here is part of my workflow script
- name: Variable substitution
uses: microsoft/variable-substitution@v1
with:
files: ./build/config.yaml
env:
sms.senderNumber: ${{ secrets.SMS_SENDER_NUMBER }}And secrets.SMS_SENDER_NUMBER is 1069368924410002259
But when the workflow is done, I check the actual config file, I got this
The value is not the same as secrets.SMS_SENDER_NUMBER
What I have done to solve this
Check if GitHub secret correct
I use the following workflow debug GitHub action via ssh:
name: Show Me the S3cr3tz
on: [push]
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up secret file
env:
SMS_SENDER_NUMBER: ${{ secrets.SMS_SENDER_NUMBER }}
run: |
echo $SMS_SENDER_NUMBER >> secrets.txt
- name: Run tmate
uses: mxschmitt/action-tmate@v2The secret value is correct
Direct write value to the workflow YAML file
- name: Variable substitution
uses: microsoft/variable-substitution@v1
with:
files: ./build/config.yaml
env:
sms.senderNumber: 1069368924410002259The result is, that the value is still altered,
Use double quotes
- name: Variable substitution
uses: microsoft/variable-substitution@v1
with:
files: ./build/config.yaml
env:
sms.senderNumber: "1069368924410002259"The result is, that the value is still altered,
Use sed command
- name: Replace sender number
run: sed -i 's/SMS_SENDER_NUMBER/${{ secrets.SMS_SENDER_NUMBER }}/' ./build/config.yamlThe result shows that the replacement is done correctly.
