Update test.yml #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Read Secret, Create File, and Verify (No Secret Printing) | |
on: | |
push: | |
jobs: | |
verify_file: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Read secret (content won't be shown in logs) | |
env: | |
SECRET_CONTENT: ${{ secrets.YOUR_SECRET_NAME }} # Replace with your secret name | |
run: echo "Secret content has been read." # Optional success message | |
- name: Create file from secret | |
run: | | |
echo "$SECRET_CONTENT" > secret_data.txt # Replace with desired filename | |
chmod 600 secret_data.txt # Set file permissions (optional) | |
- name: Verify file creation (without revealing content) | |
run: | | |
# Check if the file exists and has expected size | |
if [[ -f secret_data.txt && $(wc -c < secret_data.txt) -gt 0 ]]; then | |
echo "File 'secret_data.txt' created successfully." | |
else | |
echo "Error: File creation failed or empty." | |
exit 1 # Fail the workflow if file creation has issues | |
fi |