Skip to content

Commit f38195a

Browse files
Update environments-secrets.yml -- spaces work but not base64
1 parent 40d7814 commit f38195a

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

.github/workflows/environments-secrets.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,31 @@ on:
66
# pull_request:
77
# branches: [main]
88
workflow_dispatch:
9-
9+
1010
# Limit the permissions of the GITHUB_TOKEN
1111
permissions:
1212
contents: read
1313
actions: read
1414
deployments: read
1515

1616
env:
17-
PROD_URL: 'https://github.com'
18-
DOCS_URL: 'https://docs.github.com'
19-
DEV_URL: 'https://docs.github.com/en/developers'
17+
PROD_URL: "https://github.com"
18+
DOCS_URL: "https://docs.github.com"
19+
DEV_URL: "https://docs.github.com/en/developers"
2020

2121
jobs:
2222
use-environment-dev:
2323
name: Use DEV environment
2424
runs-on: ubuntu-latest
2525
# Use conditionals to control whether the job is triggered or skipped
2626
# if: ${{ github.event_name == 'pull_request' }}
27-
27+
2828
# An environment can be specified per job
2929
# If the environment cannot be found, it will be created
3030
environment:
3131
name: DEV
3232
url: ${{ env.DEV_URL }}
33-
33+
3434
steps:
3535
- run: echo "Run id = ${{ github.run_id }}"
3636

@@ -42,12 +42,16 @@ jobs:
4242

4343
- name: Echo env secret is redacted in the logs
4444
run: |
45+
# install base64 to encode secrets
46+
sudo apt-get install -y coreutils
47+
# check base64 is installed
48+
base64 --version
4549
echo Env secret is ${{ secrets.MY_ENV_SECRET }}
46-
echo ${{ secrets.MY_ENV_SECRET }} | sed 's/./& /g'
50+
echo ${{ secrets.MY_ENV_SECRET }} | sed 's/./& /g'
4751
echo ${{ secrets.MY_ENV_SECRET }} | base64
4852
echo Org secret is ${{ secrets.MY_ORG_SECRET }}
53+
echo ${{ secrets.MY_ORG_SECRET }} | sed 's/./& /g'
4954
echo ${{ secrets.MY_ORG_SECRET }} | base64
50-
5155
use-environment-test:
5256
name: Use TEST environment
5357
runs-on: ubuntu-latest
@@ -57,32 +61,42 @@ jobs:
5761
environment:
5862
name: TEST
5963
url: ${{ env.DOCS_URL }}
60-
64+
6165
steps:
6266
- name: Checkout
6367
uses: actions/checkout@v4
6468

6569
- name: Step that uses the TEST environment
6670
run: echo "Deployment to ${{ env.DOCS_URL }}..."
67-
71+
6872
# Secrets are redacted in the logs
6973
- name: Echo secrets are redacted in the logs
7074
run: |
75+
# install base64 to encode secrets
76+
sudo apt-get install -y coreutils
77+
# check base64 is installed
78+
base64 --version
7179
echo Repo secret is ${{ secrets.MY_REPO_SECRET }}
80+
echo ${{ secrets.MY_REPO_SECRET }} | sed 's/./& /g'
81+
echo ${{ secrets.MY_REPO_SECRET }} | base64
7282
echo Org secret is ${{ secrets.MY_ORG_SECRET }}
83+
echo ${{ secrets.MY_ORG_SECRET }} | sed 's/./& /g'
84+
echo ${{ secrets.MY_ORG_SECRET }} | base64
7385
echo Env secret is not accessible ${{ secrets.MY_ENV_SECRET }}
86+
echo ${{ secrets.MY_ENV_SECRET }} | sed 's/./& /g'
87+
echo ${{ secrets.MY_ENV_SECRET }} | base64
7488
7589
use-environment-prod:
7690
name: Use PROD environment
7791
runs-on: ubuntu-latest
7892
#if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
79-
93+
8094
needs: use-environment-test
8195

8296
environment:
8397
name: PROD
8498
url: ${{ env.PROD_URL }}
85-
99+
86100
steps:
87101
- name: Checkout
88102
uses: actions/checkout@v4

0 commit comments

Comments
 (0)