This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (46 loc) · 2.66 KB
/
workflow-inplementation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Deploy Workflow
on:
push:
branches:
- master
workflow_dispatch:
jobs:
#this shows that the environment secrets were not loaded when dynamically passing an environment. If you open the last Action run logs you will see that MY_SECRET is empty
my-workflow-job-1:
uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template.yml@master
with:
ENVIRONMENT: myenvironment
#this shows that the environment works because the protection rule blocked the job. If you open the last Action run logs you will see that MY_SECRET is empty
my-workflow-job-2:
uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template.yml@master
with:
ENVIRONMENT: myprotectedenvironment
#this shows that the environment secrets are loaded when the job is inline. If you open the last Action run logs you will see that MY_SECRET is NOT empty. But this job is inline and it is not reusable. If you copy and paste it multiple times, you would end up having lots of repeated lines.
my-workflow-job-3:
name: my-workflow-job-3
runs-on: ubuntu-latest
environment: myenvironment
env:
MY_SECRET: ${{ secrets.MY_SECRET }}
steps:
- uses: actions/checkout@v2
- run : |
echo 'printing envs'
env
#this uses the workflow template with the fix to ensure the environment secret is actually loaded. If you open the last Action run logs you will see that MY_SECRET is NOT empty.
my-workflow-job-4:
uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template-fix.yml@master
with:
ENVIRONMENT: myenvironment
secrets:
MY_SECRET: ${{ secrets.MY_SECRET }} #it is really weird to pass a secret here because it feels that is comming from outside, from the repository secrets, not from the environment. But it magically works, and the environment secret will be loaded
#this won't work because the workflow-template-fix has MY_SECRET as a required secret. It throws a template compilation error. That is why it is commented. It is here just to show you what not do to.
#my-workflow-job-5:
# uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template-fix.yml@master
# with:
# ENVIRONMENT: myenvironment
#this won't work. If you open the last Action run logs you will see that MY_SECRET is empty. So it is a MUST that you do as in the my-workflow-job-4.
my-workflow-job-6:
uses: AllanOricil/workflow-template-bug/.github/workflows/workflow-template-fix-without-required-secret.yml@master
with:
ENVIRONMENT: myenvironment