@@ -12,7 +12,6 @@ defaults:
1212
1313permissions :
1414 contents : read
15- checks : write # Used to annotate code in the PR
1615
1716jobs :
1817 changes :
@@ -24,16 +23,23 @@ jobs:
2423 steps :
2524 - name : Get base depth
2625 id : base-depth
27- run : echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT
26+ env :
27+ PR_COMMITS : ${{ github.event.pull_request.commits }}
28+ run : echo "base-depth=$(expr "${PR_COMMITS}" + 1)" >> $GITHUB_OUTPUT
2829 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2930 with :
3031 ref : ${{ github.event.pull_request.head.sha }}
3132 fetch-depth : ${{ steps.base-depth.outputs.base-depth }}
33+ persist-credentials : false
3234 - name : detect
3335 id : detect
36+ env :
37+ GITHUB_BASE_REF_NAME : ${{ github.base_ref }}
38+ BASE_SHA : ${{ github.event.pull_request.base.sha }}
39+ HEAD_SHA : ${{ github.event.pull_request.head.sha }}
3440 run : |
35- git fetch origin ${{ github.base_ref }}
36- CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ...${{ github.event.pull_request.head.sha }} | tr ' ' '\n')
41+ git fetch origin "${GITHUB_BASE_REF_NAME}"
42+ CHANGED_FILES=$(git diff --name-only "${BASE_SHA} ...${HEAD_SHA}" | tr ' ' '\n')
3743
3844 echo -e "Changed files:\n${CHANGED_FILES}"
3945
6672 if : ${{ needs.changes.outputs.non-docs == 'true' }}
6773 steps :
6874 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+ with :
76+ persist-credentials : false
6977 - uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
7078 with :
7179 go-version-file : " go.mod"
@@ -76,10 +84,14 @@ jobs:
7684 name : lint
7785 runs-on : ubuntu-latest
7886 needs : [changes]
87+ permissions :
88+ contents : read
89+ checks : write # Used by golangci-lint-action to annotate code in the PR
7990 steps :
8091 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8192 with :
8293 fetch-depth : 0
94+ persist-credentials : false
8395 - uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
8496 with :
8597 go-version-file : " go.mod"
@@ -113,6 +125,8 @@ jobs:
113125 runs-on : ubuntu-latest
114126 steps :
115127 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
128+ with :
129+ persist-credentials : false
116130 - uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
117131 with :
118132 go-version-file : " go.mod"
@@ -125,6 +139,8 @@ jobs:
125139 runs-on : ubuntu-latest
126140 steps :
127141 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
142+ with :
143+ persist-credentials : false
128144 - uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
129145 with :
130146 go-version-file : " go.mod"
@@ -139,6 +155,8 @@ jobs:
139155 KOCACHE : /tmp/ko-cache
140156 steps :
141157 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
158+ with :
159+ persist-credentials : false
142160 - uses : actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
143161 with :
144162 go-version-file : " go.mod"
@@ -165,14 +183,21 @@ jobs:
165183 if : always()
166184 steps :
167185 - name : Check CI results
186+ env :
187+ BUILD : ${{ needs.build.result }}
188+ LINTING : ${{ needs.linting.result }}
189+ TESTS : ${{ needs.tests.result }}
190+ GENERATED : ${{ needs.generated.result }}
191+ MULTI_ARCH_BUILD : ${{ needs.multi-arch-build.result }}
192+ E2E_TESTS : ${{ needs.e2e-tests.result }}
168193 run : |
169194 results=(
170- "build=${{ needs.build.result } }"
171- "linting=${{ needs.linting.result } }"
172- "tests=${{ needs.tests.result } }"
173- "generated=${{ needs.generated.result } }"
174- "multi-arch-build=${{ needs.multi-arch-build.result } }"
175- "e2e-tests=${{ needs.e2e-tests.result } }"
195+ "build=${BUILD }"
196+ "linting=${LINTING }"
197+ "tests=${TESTS }"
198+ "generated=${GENERATED }"
199+ "multi-arch-build=${MULTI_ARCH_BUILD }"
200+ "e2e-tests=${E2E_TESTS }"
176201 )
177202 failed=0
178203 for r in "${results[@]}"; do
0 commit comments