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@v2
The 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: 1069368924410002259
The 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.yaml
The result shows that the replacement is done correctly.
How to reproduce
Here is part of my workflow script
And
secrets.SMS_SENDER_NUMBERis1069368924410002259But when the workflow is done, I check the actual config file, I got this
The value is not the same as
secrets.SMS_SENDER_NUMBERWhat I have done to solve this
Check if GitHub secret correct
I use the following workflow debug GitHub action via ssh:
The secret value is correct
Direct write value to the workflow YAML file
The result is, that the value is still altered,
Use double quotes
The result is, that the value is still altered,
Use
sedcommandThe result shows that the replacement is done correctly.