{"id":13554589,"url":"https://github.com/SonarSource/sonarcloud-github-action","last_synced_at":"2025-04-03T07:31:57.327Z","repository":{"id":40992224,"uuid":"188875157","full_name":"SonarSource/sonarcloud-github-action","owner":"SonarSource","description":"Integrate SonarCloud code analysis to GitHub Actions","archived":false,"fork":false,"pushed_at":"2024-10-11T13:21:47.000Z","size":154,"stargazers_count":593,"open_issues_count":0,"forks_count":219,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-10-30T01:36:46.347Z","etag":null,"topics":["github-actions","sonarcloud"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SonarSource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-27T16:16:45.000Z","updated_at":"2024-10-21T19:35:35.000Z","dependencies_parsed_at":"2023-01-05T05:02:54.846Z","dependency_job_id":"8b0ecfba-2b7e-4107-b31c-7dc41cab982a","html_url":"https://github.com/SonarSource/sonarcloud-github-action","commit_stats":{"total_commits":67,"total_committers":36,"mean_commits":"1.8611111111111112","dds":0.8059701492537313,"last_synced_commit":"eb211723266fe8e83102bac7361f0a05c3ac1d1b"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonarcloud-github-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonarcloud-github-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonarcloud-github-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SonarSource%2Fsonarcloud-github-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SonarSource","download_url":"https://codeload.github.com/SonarSource/sonarcloud-github-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246679036,"owners_count":20816402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","sonarcloud"],"created_at":"2024-08-01T12:02:50.873Z","updated_at":"2025-04-03T07:31:57.315Z","avatar_url":"https://github.com/SonarSource.png","language":"Shell","readme":"# Scan your code with SonarQube Cloud [![QA](https://github.com/SonarSource/sonarcloud-github-action/actions/workflows/qa.yml/badge.svg)](https://github.com/SonarSource/sonarcloud-github-action/actions/workflows/qa.yml)\n\n\u003e [!WARNING]\n\u003e This action is deprecated and will be removed in a future release. \n\u003e Please use the `sonarqube-scan-action` action instead. \n\u003e The `sonarqube-scan-action` is a drop-in replacement for this action, you can find it [here](https://github.com/marketplace/actions/official-sonarqube-scan).\n\nThis SonarSource project, available as a GitHub Action, scans your projects with SonarQube [Cloud](https://www.sonarsource.com/products/sonarcloud/).\n\n![Logo](./images/SQ_Logo_Cloud_Dark_Backgrounds.png#gh-dark-mode-only)\n![Logo](./images/SQ_Logo_Cloud_Light_Backgrounds.png#gh-light-mode-only)\n\nSonarQube [Cloud](https://www.sonarsource.com/products/sonarcloud/) (formerly SonarCloud) is a widely used static analysis solution for continuous code quality and security inspection.\n\nIt helps developers detect coding issues in 30+ languages, frameworks, and IaC platforms, including Java, JavaScript, TypeScript, C#, Python, C, C++, and [many more](https://www.sonarsource.com/knowledge/languages/).\n\nThe solution also provides fix recommendations leveraging AI with Sonar's AI CodeFix capability.\n\n## Requirements\n\n* Create your account on SonarQube Cloud. [Sign up for free](https://www.sonarsource.com/products/sonarcloud/signup/?utm_medium=referral\u0026utm_source=github\u0026utm_campaign=sc-signup\u0026utm_content=signup-sonarcloud-listing-x-x\u0026utm_term=ww-psp-x) now if it's not already the case!\n* The repository to analyze is set up on SonarQube Cloud. [Set it up](https://sonarcloud.io/projects/create) in just one click.\n\n## Usage\n\nProject metadata, including the location of the sources to be analyzed, must be declared in the file `sonar-project.properties` in the base directory:\n\n```properties\nsonar.organization=\u003creplace with your SonarQube Cloud organization key\u003e\nsonar.projectKey=\u003creplace with the key generated when setting up the project on SonarQube Cloud\u003e\n\n# relative paths to source directories. More details and properties are described\n# at https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/analysis-scope/\nsonar.sources=.\n```\n\nThe workflow, usually declared under `.github/workflows`, looks like:\n\n```yaml\non:\n  # Trigger analysis when pushing to your main branches, and when creating a pull request.\n  push:\n    branches:\n      - main\n      - master\n      - develop\n      - 'releases/**'\n  pull_request:\n      types: [opened, synchronize, reopened]\n\nname: Main Workflow\njobs:\n  sonarqube:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        # Disabling shallow clones is recommended for improving the relevancy of reporting\n        fetch-depth: 0\n    - name: SonarQube Scan\n      uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e # Ex: v4.0.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan\n      env:\n        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n```\n\n## Action parameters\n\nYou can change the analysis base directory by using the optional input `projectBaseDir` like this:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  with:\n    projectBaseDir: app/src\n```\n\nIn case you need to specify the version of the Sonar Scanner, you can use the `scannerVersion` option:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  with:\n    scannerVersion: 6.2.0.4584\n```\n\nIn case you need to add additional analysis parameters, and you do not wish to set them in the `sonar-project.properties` file, you can use the `args` option:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  with:\n    projectBaseDir: app/src\n    args: \u003e\n      -Dsonar.organization=my-organization\n      -Dsonar.projectKey=my-projectkey\n      -Dsonar.python.coverage.reportPaths=coverage.xml\n      -Dsonar.sources=lib/\n      -Dsonar.tests=tests/\n      -Dsonar.test.exclusions=tests/**\n      -Dsonar.verbose=true\n```\n\nYou can also specify the URL where to retrieve the SonarScanner CLI from.\nThe specified URL overrides the default address: `https://binaries.sonarsource.com/Distribution/sonar-scanner-cli`.\nThis can be useful when the runner executing the action is self-hosted and has regulated or no access to the Internet:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  with:\n    scannerBinariesUrl: https://my.custom.binaries.url.com/Distribution/sonar-scanner-cli/\n```\n\nMore information about possible analysis parameters can be found in the [Analysis parameters page](https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/analysis-parameters/) of the SonarQube Cloud documentation.\n\n### Environment variables\n\n- `SONAR_TOKEN` – **Required** this is the token used to authenticate access to SonarQube. You can read more about security tokens in the [documentation](https://docs.sonarsource.com/sonarqube-cloud/managing-your-account/managing-tokens/). You can set the `SONAR_TOKEN` environment variable in the \"Secrets\" settings page of your repository, or you can add them at the level of your GitHub organization (recommended).\n- *`GITHUB_TOKEN` – Provided by Github (see [Authenticating with the GITHUB_TOKEN](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token)).*\n- `SONAR_ROOT_CERT` – Holds an additional certificate (in PEM format) that is used to validate the certificate of a secured proxy to SonarQube Cloud. You can set the `SONAR_ROOT_CERT` environment variable in the \"Secrets\" settings page of your repository, or you can add them at the level of your GitHub organization (recommended).\n\nHere is an example of how you can pass a certificate (in PEM format) to the Scanner truststore:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  env:\n    SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n    SONAR_ROOT_CERT: ${{ secrets.SONAR_ROOT_CERT }}\n```\n\nIf your source code file names contain special characters that are not covered by the locale range of `en_US.UTF-8`, you can configure your desired locale like this:\n\n```yaml\n- uses: sonarsource/sonarcloud-github-action@\u003caction version\u003e\n  env:\n    SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}\n    LC_ALL: \"ru_RU.UTF-8\"\n```\n\n## Alternatives for Java, .NET, and C/C++ projects\n\nThis GitHub Action will not work for all technologies. If you are in one of the following situations, you should use the following alternatives:\n\n* Your code is built with Maven. Read the documentation about our [SonarScanner for Maven](https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/ci-based-analysis/sonarscanner-for-maven/).\n* Your code is built with Gradle. Read the documentation about our [SonarScanner for Gradle](https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/ci-based-analysis/sonarscanner-for-gradle/).\n* You want to analyze a .NET solution. Read the documentation about our [SonarScanner for .NET](https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/ci-based-analysis/sonarscanner-for-dotnet/introduction/).\n* You want to analyze C or C++ code. Starting from SonarQube 10.6, this GitHub Action will scan C and C++ out of the box. If you want to have better control over the scan configuration/setup, you can switch to the [SonarQube Cloud Scan for C and C++](https://github.com/marketplace/actions/sonarcloud-scan-for-c-and-c) GitHub Action - look at [our sample C and C++ project](https://github.com/sonarsource-cfamily-examples?q=gh-actions-sc\u0026type=all\u0026language=\u0026sort=).\n\n## Have questions or feedback?\n\nTo provide feedback (requesting a feature or reporting a bug) please post on the [SonarSource Community Forum](https://community.sonarsource.com/tags/c/help/sc/9/github-actions).\n\n## License\n\nContainer images built with this project include third-party materials.\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSonarSource%2Fsonarcloud-github-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSonarSource%2Fsonarcloud-github-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSonarSource%2Fsonarcloud-github-action/lists"}