ci: analyse each branch as itself, not as main !259
1 file changed, +12 −1
Layout: unified · split
.gitbay/ci.yml +12 −1
| @@ -53,5 +53,16 @@ jobs: | ||
| 53 | 53 | unzip -q -o "$HOME_DIR/.sonar/sonar-scanner.zip" -d "$HOME_DIR/.sonar/" |
| 54 | 54 | rm -f "$HOME_DIR/.sonar/sonar-scanner.zip" |
| 55 | 55 | fi |
| 56 | # Analyse each branch as itself. Without this every branch is | |
| 57 | # recorded against the project's main branch, so a feature branch | |
| 58 | # replaces main's results — a branch that removes findings makes | |
| 59 | # main look clean before its fix is merged, and one that adds | |
| 60 | # findings makes main look broken when it is not (#154). | |
| 61 | BRANCH="${GITBAY_REF:-}" | |
| 62 | BRANCH="${BRANCH#refs/heads/}" | |
| 63 | BRANCH_ARG="" | |
| 64 | if [ -n "$BRANCH" ] && [ "$BRANCH" != "main" ]; then | |
| 65 | BRANCH_ARG="-Dsonar.branch.name=$BRANCH" | |
| 66 | fi | |
| 56 | 67 | SONAR_HOST_URL=https://sonarcloud.io \ |
| 57 | "$SCANNER/bin/sonar-scanner" -Dsonar.scm.revision="${GITBAY_SHA:-}" || true | |
| 68 | "$SCANNER/bin/sonar-scanner" -Dsonar.scm.revision="${GITBAY_SHA:-}" $BRANCH_ARG || true | |