Skip to content

BUILD-10590 Add verified-approvals required workflow#227

Closed
julien-carsique-sonarsource wants to merge 5 commits intomasterfrom
feat/jcarsique/BUILD-10590-verifiedApprovals
Closed

BUILD-10590 Add verified-approvals required workflow#227
julien-carsique-sonarsource wants to merge 5 commits intomasterfrom
feat/jcarsique/BUILD-10590-verifiedApprovals

Conversation

@julien-carsique-sonarsource
Copy link
Contributor

@julien-carsique-sonarsource julien-carsique-sonarsource commented Mar 4, 2026

Summary

  • Adds github/verified-approvals.yml as a required workflow for the SonarSource org ruleset #4485920
  • Enforces approval requirements before merging:
    • 1 approval for internal PRs (same repo)
    • 2 approvals for external PRs (forks)
  • Triggers on pull_request (opened, synchronize, reopened, ready_for_review) and pull_request_review (submitted, dismissed) events

Depends on

Test plan

  • Configure ruleset #4485920: set "Require workflows to pass before merging" → SonarSource/ci-github-actions@master:github/verified-approvals.yml
  • Test with sonar-dummy-python-oss: open a PR and verify the verified-approvals check appears and behaves correctly for both internal and external PRs

Tested with:

@hashicorp-vault-sonar-prod
Copy link

hashicorp-vault-sonar-prod bot commented Mar 4, 2026

BUILD-10590

@julien-carsique-sonarsource julien-carsique-sonarsource force-pushed the feat/jcarsique/BUILD-10590-verifiedApprovals branch 5 times, most recently from cc45fdf to 2c501ec Compare March 5, 2026 11:14
Checks PR approvals to enforce the SonarSource org ruleset:
- 1 approval required for internal PRs
- 2 approvals required for external (fork) PRs

Triggers on pull_request and pull_request_review (submitted/dismissed) events.
Skips approval check for merge_group events (always pass).
Considers a PR as external if it contains commits from non-org members
(in addition to the fork check); bot accounts are excluded.
Uses committer login (who pushed) instead of declared author (which can be faked).
Uses a dedicated {REPO_OWNER_NAME_DASH}-approvals vault token (members:read)
for all org membership checks (commit committers and PR approvers).
…nal contribution detection

Bot accounts (type Bot) remain excluded and treated as internal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 6, 2026

SonarQube reviewer guide

Review in SonarQube

Summary: Adds GitHub Actions workflows to enforce verified approvals on pull requests, requiring 2 approvals for external contributions and 1 for internal PRs.

Review Focus: Pay close attention to the approval verification logic in verified-approvals.yml, particularly:

  • The external PR detection (fork check + commit author validation)
  • The org-member approval counting logic using jq to filter review states
  • Token usage: ensure PR_APPROVALS secret is properly configured with org read permissions
  • Edge cases: handling of bot accounts, pagination of commits/reviews, and the merge_group event bypass

Start review at: .github/workflows/verified-approvals.yml. This is the core workflow containing the approval enforcement logic and security-critical access control decisions that will directly impact PR merge eligibility.

💬 Please send your feedback

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues
0 Dependency risks

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant