I was trying to do the following :
echo ${{secrets.key}} > myfile
But unfortunately, this doesn't work since myfile would be empty after this when i checked. How do i save the content of github secret into a file ?
You could upload the file as an artifact , then you could see the secret variable value after downloading the artifact.
Here is an example:
name: get secrets
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: print secrets
run: |
echo $SECRET_KEY >> file.txt
cat file.txt
shell: bash
env:
SECRET_KEY : ${{secrets.MY_SECRET}}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: SECRET_KEY
path: file.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.