-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: GitHub Actions Secret Example | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
secrets-in-github-actions: | ||
runs-on: windows-latest | ||
|
||
# The Secrect Actions GitHub example has three steps | ||
steps: | ||
# Show how to print unmasked GitHub secrets to the console | ||
- name: Step 1 - Echo out a GitHub Actions Secret to the logs | ||
run: | | ||
echo "The GitHub Action Secret will be masked: " | ||
echo ${{ secrets.DEVUPLOAD }} | ||
echo "Trick to echo GitHub Actions Secret: " | ||
echo ${{secrets.DEVUPLOAD}} | sed 's/./& /g' | ||
# Use a GitHub Actions secret variable in a bash shell | ||
- name: Step 2 - GitHub Action if statement (true) | ||
env: | ||
WHO_TO_TRUST: ${{ secrets.DEVUPLOAD }} | ||
if: env.WHO_TO_TRUST == 'TrustNo1' | ||
run: echo "I know what the secret token is!" | ||
|
||
# A GitHub Actions if statement with a secret environment variable | ||
- name: Step 3 - Conditional GitHub Action (false) | ||
shell: bash | ||
env: | ||
WHO_TO_TRUST: ${{ secrets.SECRET_TOKEN }} | ||
if: env.WHO_TO_TRUST != 'TrustNobody' | ||
run: echo "I was wrong thinking the GitHub secret was 'TrustNobody'!" |