Skip to content

Add Z-Skip-Sonar check#31409

Merged
langleyd merged 3 commits into
developfrom
langleyd/skip-sonar
Dec 3, 2025
Merged

Add Z-Skip-Sonar check#31409
langleyd merged 3 commits into
developfrom
langleyd/skip-sonar

Conversation

@langleyd
Copy link
Copy Markdown
Member

@langleyd langleyd commented Dec 3, 2025

Adds a label to allow the the madatory sonarcube check to be skipped in exceptional circumstances(the effort to get the last % is inordinately high, we don't agree with it's recommendations, etc).

@langleyd langleyd added T-Task Tasks for the team like planning Z-Skip-Sonar labels Dec 3, 2025
Comment thread .github/workflows/sonarqube.yml Outdated
Comment on lines +12 to +43
check-skip-label:
name: Check for skip label
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'merge_group'
outputs:
should-skip: ${{ steps.check-labels.outputs.skip }}
permissions:
pull-requests: read
steps:
- name: Check labels
id: check-labels
uses: actions/github-script@v7
with:
script: |
const prs = context.payload.workflow_run.pull_requests;

if (prs.length === 0) {
core.setOutput('skip', 'false');
return;
}

// Get full PR details including labels
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prs[0].number
});

const hasSkipLabel = pr.labels.some(label => label.name === 'Z-Skip-Sonar');
core.setOutput('skip', hasSkipLabel ? 'true' : 'false');

console.log(`PR #${pr.number}: ${hasSkipLabel ? 'Skipping' : 'Running'} SonarQube`);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing me in the right direction.

@langleyd langleyd added this pull request to the merge queue Dec 3, 2025
Merged via the queue into develop with commit 5a96563 Dec 3, 2025
49 checks passed
@langleyd langleyd deleted the langleyd/skip-sonar branch December 3, 2025 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Task Tasks for the team like planning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants