Skip to content

Commit fb8dbb5

Browse files
committed
ci: harden sonarcloud workflow
1 parent e48f3a1 commit fb8dbb5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/sonarcloud.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2121
with:
2222
fetch-depth: 0
23+
persist-credentials: false
2324

2425
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2526
with:
@@ -48,11 +49,13 @@ jobs:
4849
- name: Read SonarCloud token from Key Vault
4950
if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.head.repo.fork == false && contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.pull_request.author_association)) }}
5051
id: sonar_token
52+
env:
53+
AZURE_KEYVAULT_NAME: ${{ vars.AZURE_KEYVAULT_NAME }}
5154
shell: bash
5255
run: |
5356
set -euo pipefail
5457
SONAR_TOKEN="$(az keyvault secret show \
55-
--vault-name "${{ vars.AZURE_KEYVAULT_NAME }}" \
58+
--vault-name "$AZURE_KEYVAULT_NAME" \
5659
--name "sonar-cloud-token" \
5760
--query value -o tsv)"
5861
if [ -z "${SONAR_TOKEN}" ]; then

0 commit comments

Comments
 (0)