Skip to content

Commit b0cc14c

Browse files
ci: harden sonarcloud workflow
1 parent 14d6e75 commit b0cc14c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 5 additions & 2 deletions
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:
@@ -39,7 +40,7 @@ jobs:
3940
4041
- name: Azure login (OIDC)
4142
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)) }}
42-
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5
43+
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43
4344
with:
4445
client-id: ${{ vars.AZURE_CLIENT_ID }}
4546
tenant-id: ${{ vars.AZURE_TENANT_ID }}
@@ -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)