Skip to content

Commit ffd4470

Browse files
committed
ci: исправить условие Sonar шага для GitHub Actions
- Убрано прямое использование secrets в if - SONAR_TOKEN перенесен в env test-job
1 parent 33f968f commit ffd4470

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
test:
5050
name: Tests
5151
runs-on: ubuntu-latest
52+
env:
53+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5254
services:
5355
postgres:
5456
image: postgres:16-alpine
@@ -91,7 +93,7 @@ jobs:
9193
run: uv run pytest -q --cov=app --cov-report=term-missing --cov-report=xml --junitxml=pytest.xml
9294

9395
- name: SonarCloud Scan
94-
if: ${{ secrets.SONAR_TOKEN != '' && vars.SONAR_PROJECT_KEY != '' && vars.SONAR_ORGANIZATION != '' }}
96+
if: ${{ env.SONAR_TOKEN != '' && vars.SONAR_PROJECT_KEY != '' && vars.SONAR_ORGANIZATION != '' }}
9597
uses: SonarSource/sonarqube-scan-action@v5
9698
with:
9799
args: >
@@ -104,7 +106,7 @@ jobs:
104106
-Dsonar.python.coverage.reportPaths=coverage.xml
105107
-Dsonar.python.xunit.reportPath=pytest.xml
106108
env:
107-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
109+
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
108110
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109111

110112
- name: Upload coverage report

0 commit comments

Comments
 (0)