bcgov/Test and Analyze with Triggers and SonarCloud
Run node tests based on triggers, optional SonarCloud
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Activelast commit Jun 25, 2026
- License
- Apache 2.0
Pinned Snippet
uses: bcgov/action-test-and-analyse@8f699e3fd3fadd9a6adf6f4b1f2638ef7ecfefb9 # v2.0.0tags can be moved; commit SHAs can't. why a SHA?
Inputs
| name | description | required | default |
|---|---|---|---|
| commands | Commands to run tests, start with '|' for multi-line | yes | — |
| dir | App/package directory | yes | — |
| node_version | Node version to use (e.g., '24') | — | 24 |
| java_version | Java version to use (e.g., '21') | — | 21 |
| java_distribution | Java distribution to use (e.g., temurin) | — | temurin |
| python_version | Python version to use (e.g., '3.12') | — | 3.12 |
| language | Primary language of the project. Options: node (default), java, python | — | node |
| cache | Package manager for caching; e.g. npm, yarn, pnpm | — | npm |
| sonar_args | SonarCloud command line arguments | — | -Dsonar.organization=bcgov-sonarcloud -Dsonar.projectKey=bcgov_${{ github.repository }} |
| sonar_token | Sonar token, provide unpopulated token for pre-setup (will skip) | — | — |
| triggers | Paths (array) used to trigger a build; e.g. ('./backend/' './frontend/) | — | — |
| supply_scan | Enable supply chain attack detection using @aikidosec/safe-chain | — | true |
| dep_scan | Enable dependency and export analysis using Knip for JS/TS projects. Options: off (skip), warn (run but don't fail, default), error (run and fail on issues) | — | warn |
| knip_config | Path to custom Knip configuration file (relative to workspace root). If not provided, uses action's default configuration | — | "" |
| diff_branch | Branch to diff against | — | ${{ github.event.repository.default_branch }} |
| repository | Non-default repository to clone (used for testing this action) | — | ${{ github.repository }} |
| branch | Non-default branch to clone (used for testing this action) | — | "" |
| skip_checkout | Skip the internal checkout step. Useful for self-testing or when the project is already checked out. | — | false |
| checkout_path | Path where the repository should be checked out. Default is current directory. | — | . |
Outputs
| name | description |
|---|---|
| triggered | Whether the action was triggered based on path changes |
| unused_files | Number of unused files found by Knip |
| unused_deps | Number of unused dependencies found by Knip |
| total_issues | Total number of issues found by Knip |
| knip_config | The Knip configuration file that was auto-discovered or specified |