Skip to content

Commit 35bb9a7

Browse files
authored
Merge branch 'main' into add-ci-failure-notifications
2 parents e8732e2 + f0ffd9a commit 35bb9a7

4 files changed

Lines changed: 35 additions & 24 deletions

File tree

.github/workflows/ack.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
run: echo "$GITHUB_CONTEXT"
3434

3535
- uses: bcoe/conventional-release-labels@v1
36+
with:
37+
type_labels: '{"feat": "feature", "fix": "fix", "breaking": "breaking", "chore": "chore"}'
38+
ignored_types: "[]"
3639

3740
- name: Verify PR label action
3841
if: github.event_name != 'merge_group'

.github/workflows/tox.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -254,40 +254,44 @@ jobs:
254254
# - name: Fix paths in coverage file
255255
# run: |
256256
# sed -i 's/\/home\/runner\/work\/anonymizer\/anonymizer/\/github\/workspace\//g' coverage.xml
257-
- name: "Extract and export repo owner/name"
257+
- name: Prepare SonarCloud args
258+
# Run only for pull requests or push to main
259+
if: >
260+
${{ !cancelled() &&
261+
hashFiles('**/coverage.xml') != '' &&
262+
(github.event_name == 'pull_request' ||
263+
(github.event_name == 'push' && github.ref_name =='main')
264+
)}}
258265
shell: bash
259266
run: |
267+
PR_NUMBER=${{ github.event.number }}
268+
PR_HEAD_SHA=${{ github.event.pull_request.head.sha }}
260269
# 1. Read the full slug (owner/repo)
261270
REPO_SLUG="${GITHUB_REPOSITORY}"
262271
# 2. Split into owner and repo
263272
IFS="/" read -r REPO_OWNER REPO_NAME <<< "$REPO_SLUG"
264273
# 3. Export to the workflow environment
265274
echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_ENV
266275
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
267-
268-
- name: SonarCloud scan (pull request)
269-
if: ${{ !cancelled() && hashFiles('**/coverage.xml') != '' && github.event_name == 'pull_request' }}
270-
uses: SonarSource/sonarqube-scan-action@v6
271-
env:
272-
SONAR_TOKEN: ${{ secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT || secrets.AAP_ORG_SONAR_TOKEN_ANSIBLE_CICD_BOT }}
273-
with:
274-
args: >
275-
-Dsonar.projectKey=${{ env.REPO_OWNER }}_${{ env.REPO_NAME }}
276-
-Dsonar.organization=${{ env.REPO_OWNER }}
277-
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
278-
-Dsonar.pullrequest.key=${{ env.PR_NUMBER }}
279-
-Dsonar.pullrequest.branch=${{ env.PR_HEAD }}
280-
continue-on-error: true
281-
282-
- name: SonarCloud scan (push)
283-
if: ${{ !cancelled() && hashFiles('**/coverage.xml') != '' && github.event_name == 'push' && github.ref_name == 'main' }}
276+
SONAR_ARGS="-Dsonar.projectKey=${REPO_OWNER}_${REPO_NAME} -Dsonar.organization=${REPO_OWNER}"
277+
if [[ -n "$PR_NUMBER" ]]; then
278+
SONAR_ARGS="${SONAR_ARGS} -Dsonar.pullrequest.key=${PR_NUMBER} -Dsonar.pullrequest.branch=${PR_HEAD_SHA}"
279+
fi
280+
echo SONAR_ARGS="$SONAR_ARGS" >> $GITHUB_ENV
281+
282+
- name: SonarCloud scan
283+
# Run only for pull requests or push to main
284+
if: >
285+
${{ !cancelled() &&
286+
hashFiles('**/coverage.xml') != '' &&
287+
(github.event_name == 'pull_request' ||
288+
(github.event_name == 'push' && github.ref_name =='main')
289+
)}}
284290
uses: SonarSource/sonarqube-scan-action@v6
285291
env:
286292
SONAR_TOKEN: ${{ secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT || secrets.AAP_ORG_SONAR_TOKEN_ANSIBLE_CICD_BOT }}
287293
with:
288-
args: >
289-
-Dsonar.projectKey=${{ env.REPO_OWNER }}_${{ env.REPO_NAME }}
290-
-Dsonar.organization=${{ env.REPO_OWNER }}
294+
args: ${{ env.SONAR_ARGS }}
291295
continue-on-error: true
292296

293297
check:

.sonarcloud.properties

Lines changed: 0 additions & 3 deletions
This file was deleted.

sonar-project.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sonar.python.version=3.10, 3.11, 3.12, 3.13
2+
sonar.sources=src/
3+
sonar.tests=test/
4+
# Ignore GitHub Actions rule S7637 across the repository
5+
sonar.issue.ignore.multicriteria=gha1
6+
sonar.issue.ignore.multicriteria.gha1.ruleKey=githubactions:S7637
7+
sonar.issue.ignore.multicriteria.gha1.resourceKey=.github/workflows/**/*

0 commit comments

Comments
 (0)