GitHub Action Pipeline format for Sonar Pull request

I do created one format for the github action pipeline for the sonar pull request template but I cant able to do it as it is showing up the error if I do the same … name: SonarQube Qualitygate check

on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request. 
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0
        
    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master 
      # Force to fail step after specific time.
      timeout-minutes: 5
      env:
        SONAR_LOGIN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

What error do you see?

Hey there.

It doesn’t look like there’s any error in the screenshot of logs you shared, and please share logs in text format rather than screenshots.

its showing as execution failure … >>>>>>

##[debug]Evaluating: secrets.TM_SONAR_TOKEN

##[debug]Evaluating Index:

##[debug]..Evaluating secrets:

##[debug]..=> Object

##[debug]..Evaluating String:

##[debug]..=> 'TM_SONAR_TOKEN'
##[debug]=> '***'

##[debug]Result: '***'

##[debug]Evaluating: secrets.TM_SONAR_HOST_URL

##[debug]Evaluating Index:

##[debug]..Evaluating secrets:

##[debug]..=> Object

##[debug]..Evaluating String:

##[debug]..=> 'TM_SONAR_HOST_URL'

##[debug]=> '***'

##[debug]Result: '***'

##[debug]Evaluating condition for step: 'SonarQube Scan'

##[debug]Evaluating: success()

##[debug]Evaluating success:

[debug]=> true

##[debug]Result: true

##[debug]Starting: SonarQube Scan

##[debug]Register post job cleanup for action: SonarSource/sonarqube-scan-action@master
##[debug]Loading inputs
##[debug]Loading env

Run SonarSource/sonarqube-scan-action@master
33)/usr/bin/docker run --name bebb0b4094726a38064eeeb945753_521cb3 --label 290506 --workdir /github/workspace --rm -e "SONAR_TOKEN" -e "SONAR_HOST_URL" -e "INPUT_PROJECTBASEDIR" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_DEBUG" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/entrypoint.sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/tokenmetrics-2.0/tokenmetrics-2.0":"/github/workspace" 290506:793bebb0b4094726a38064eeeb945753

INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties

35)INFO: Project root configuration file: NONE

INFO: SonarScanner 4.8.0.2856
INFO: Java 11.0.17 Alpine (64-bit)

INFO: Linux 5.15.0-1024-azure amd64

 User cache: /opt/sonar-scanner/.sonar/cache

ERROR: Failed bootstrap index response: <!doctype html><html lang="en"><head><meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"><link rel="apple-touch-icon" href="/apple-touch-icon.png"><link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-57x57.png"><link rel="apple-touch-icon" sizes="60x60" href="/apple-touch-icon-60x60.png"><link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"><link rel="apple-touch-icon" sizes="76x76" href="/apple-touch-icon-76x76.png"><link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"><link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-120x120.png"><link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png"><link rel="apple-touch-icon" sizes="152x152" href="/apple-touch-icon-152x152.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon-180x180.png"><link rel="icon" type="image/x-icon" href="/favicon.ico"><meta name="application-name" content="SonarQube"/><meta name="msapplication-TileColor" content="#FFFFFF"/><meta name="msapplication-TileImage" content="/mstile-512x512.png"/><title>SonarQube</title><style>*,:after,:before{margin:0;padding:0}body,html{background-color:#f3f3f3}body{overflow-y:scroll}fieldset,img{border:0}address,caption,cite,code,dfn,th,var{font-style:normal;font-weight:400}caption,th{text-align:left}q:after,q:before{content:""}abbr,acronym{border:0;font-variant:normal}input,select,textarea{font-weight:inherit}button,input,select,textarea{font-family:inherit;font-size:inherit}textarea{min-height:40px}button::-moz-focus-inner,input::-moz-focus-inner,select::-moz-focus-inner{border:0;padding:0}legend{color:#000}code,kbd,pre,samp,tt{font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px;line-height:18px}img,svg{vertical-align:top;overflow:visible}hr{margin:4px 0;padding:0;height:1px;border:none;background-color:#e6e6e6}body,html{color:#444}body{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13px;line-height:1.23076923}.h1,h1{line-height:24px;color:#444;font-size:16px;font-weight:400}.h1 img,.h1 svg,h1 img,h1 svg{vertical-align:middle;transform:translateY(-1px)}.h2,h2{line-height:24px;color:#444;font-size:15px;font-weight:400}.h2 img,.h2 svg,h2 img,h2 svg{vertical-align:middle;transform:translateY(-1px)}.h3,h3{line-height:24px;color:#444;font-size:14px;font-weight:600}.h3 img,.h3 svg,h3 img,h3 svg{vertical-align:middle;transform:translateY(-1px)}.h4,h4{line-height:24px;color:#444;font-size:13px;font-weight:600}.h4 img,.h4 svg,h4 img,h4 svg{vertical-align:middle;transform:translateY(-1px)}.h5,h5{line-height:24px;color:#444;font-size:13px;font-weight:600}.h5 img,.h5 svg,h5 img,h5 svg{vertical-align:middle;transform:translateY(-1px)}.h6,h6{line-height:24px;color:#444;font-size:13px;font-weight:600}.h6 img,.h6 svg,h6 img,h6 svg{vertical-align:middle;transform:translateY(-1px)}sup{vertical-align:text-top}sub{vertical-align:text-bottom}em{font-style:italic}strong{font-weight:600}mark{background:0 0;color:#444;font-weight:700}blockquote{border-left:3px solid #e6e6e6;padding:0 8px;line-height:1.5}blockquote cite{line-height:1.5;color:#777;font-size:12px}.small,small{font-size:12px}.medium{font-size:14px}.big{font-size:16px}.huge{font-size:24px}.zero-font-size{font-size:0!important}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-justify{text-align:justify}.text-top{vertical-align:top!important}.text-middle{vertical-align:middle!important}.text-bottom{vertical-align:bottom!important}.text-text-top{vertical-align:text-top!important}.text-text-bottom{vertical-align:text-bottom!important}.text-baseline{vertical-align:baseline!important}.text-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-limited-small{max-width:8vw}.text-limited,.text-limited-small{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-limited{max-width:16vw}.text-uppercase{text-transform:uppercase}.text-lowercase{text-transform:lowercase}.text-no-transform{text-transform:none}.text-light{font-weight:300!important}.text-normal{font-weight:400!important}.text-bold{font-weight:700!important}.text-muted{color:#777}.text-muted-2{color:#b4b4b4}.text-danger{color:#d4333f!important}.text-warning{color:#ed7d20!important}.text-info{color:#4b9fd5!important}.text-success{color:#0a0!important}.monospaced{line-height:18px;font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px}a{border-bottom:1px solid #cae3f2;color:#236a97;cursor:pointer;outline:0;text-decoration:none;transition:all .2s ease}a:active,a:focus,a:hover{color:#4b9fd5}.link-base-color{border-bottom:1px solid #d0d0d0!important;color:#444!important}.link-base-color:active,.link-base-color:focus,.link-base-color:hover{color:#4b9fd5!important}.link-base-color:active,.link-base-color:focus,.link-base-color:hover{border-bottom-color:#cae3f2!important}.link-no-underline{border-bottom:none!important}.link-underline{border-bottom:1px solid #cae3f2!important}.link-with-icon{border-bottom:none}.link-with-icon>span:last-child{border-bottom:1px solid #cae3f2}.link-checkbox{color:inherit;border-bottom:none}.link-checkbox.disabled,.link-checkbox.disabled label,.link-checkbox.disabled:hover{color:#777;cursor:not-allowed}.link-checkbox:active,.link-checkbox:focus,.link-checkbox:hover{color:inherit}.link-checkbox-control{display:inline-block;padding:4px 0 5px;line-height:16px}.link-active,a.active-link{border-bottom:none;cursor:default}a.text-muted{border-bottom:1px solid #ddd;color:#777}a.text-muted:active,a.text-muted:focus,a.text-muted:hover{color:#5e5e5e}a.favorite-link:focus,a.set-homepage-link:focus,a.text-muted:focus{outline:1px dotted #4b9fd5}table{border-collapse:collapse;border-spacing:0}table.form td{padding:2px 5px;vertical-align:top}table.form th{padding:2px 5px;font-weight:600}table.form td.keyCell{width:1%;white-space:nowrap;text-align:right;font-weight:700;vertical-align:top}table.form td img{vertical-align:bottom}table.spaced th{font-weight:700;color:#333;padding:4px 5px}table.spaced td{padding:3px 5px;line-height:18px}table.spaced td img{vertical-align:text-bottom}table.spacedicon th{font-weight:700;color:#333;padding:4px 5px}table.spacedicon td{padding:0 5px;height:24px}.thin{width:1%}.spacer{width:5px}.formError,.spacer{display:inline-block}.formError{background-color:#ed7d20;color:#000;padding:0 5px}.table>thead>tr>th{border-top:0;font-weight:700;line-height:16px;padding:4px 5px;vertical-align:bottom}.table>tbody>tr>td{line-height:16px;padding:4px 5px;vertical-align:top}.table>tfoot>tr>td{font-size:93%;color:#777;padding:4px 5px}.table>tfoot>tr>td a{color:#777}.hoverable:hover{background-color:#cae3f2}.hoverable:hover a{color:#111}.odd{background-color:#fff}.even{background-color:#f5f5f5}.even.selected,.even.selected a,.even.selected span:not(.rating),.odd.selected,.odd.selected a,.odd.selected span:not(.rating){background-color:#d9edf7;color:#444}.table-cell-doc{position:absolute;z-index:3;right:-8px}th>.table-cell-doc{top:50%;margin-top:-6px}td.sep{width:10px}table.matrix tfoot td{padding:3px 5px;line-height:18px}table.data,table.spaced{width:100%}table.data td.small,table.data th.small{padding:0;white-space:nowrap}table.data>thead>tr>th{position:relative;vertical-align:top;line-height:18px;padding:8px 10px;border-bottom:1px solid #e6e6e6;font-weight:600}table.data>thead>tr>th>.small{display:block;line-height:1.4;font-weight:400}table.data>tfoot>tr>td{font-size:93%;color:#777;padding:5px}table.data>tbody>tr>td{position:relative;padding:8px 10px;vertical-align:text-top;line-height:16px}table.data>tbody>tr>td.text-middle{vertical-align:middle}.data thead tr.total{background-color:#efefef;font-weight:400;border:1px solid #ddd}.data thead tr.total th{font-weight:400}.data td.blank,.data tr.blank,.data tr.blank>td{background-color:#fff!important;line-height:15px}.data tr.highlight{background-color:#cae3f2}.data button,.data input,.data select{vertical-align:middle}table.data.condensed>tbody>tr>td{padding-top:5px;padding-bottom:5px}table.data tr.subheader th{font-size:12px;border-bottom:none}table.data:not(.boxed-padding)>thead:after{display:block;line-height:5px;content:"\200C"}table.data.boxed-padding>thead>tr>th{padding-top:24px}table.data.boxed-padding>tbody>tr>td:first-child,table.data.boxed-padding>tbody>tr>td:last-child,table.data.boxed-padding>thead>tr>th:first-child,table.data.boxed-padding>thead>tr>th:last-child{width:20px;padding:8px 0}table.data.no-outer-padding>tbody>tr>td:first-child,table.data.no-outer-padding>thead>tr>th:first-child{padding-left:0}table.data.no-outer-padding>tbody>tr>td:last-child,table.data.no-outer-padding>thead>tr>th:last-child{padding-right:0}table.data.boxed-padding>thead+tbody>tr:first-child>td{padding-top:16px}table.data.zebra-hover>tbody>tr:hover{background-color:#ecf6fe!important}table.data.zebra>tbody>tr.selected{background-color:#d9edf7!important}table.data.zebra.zebra-inversed>tbody>tr:nth-child(odd),table.data.zebra:not(.zebra-inversed)>tbody>tr:nth-child(2n){background-color:#f5f5f5}table#project-history tr>td{vertical-align:top}table.fixed{table-layout:fixed}table.fixed th.action-small{width:30px}table.fixed th.action{width:50px}ol,ul{padding-left:0;list-style:none}.list-styled{margin-bottom:10px;padding-left:40px}.list-styled.no-padding{padding-left:16px}ul.list-styled{list-style:disc}ol.list-styled{list-style:decimal}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;vertical-align:top;padding-right:5px;padding-left:5px}.list-spaced{margin-bottom:10px;list-style:none}.list-spaced>li{margin-top:10px}.list-item-checkable-link{cursor:pointer}.list-item-checkable-link:focus{outline:0}.list-item-checkable-link.disabled{opacity:.7}.list-item-checkable-link.disabled a:before{background-color:#cdcdcd;border-color:#cdcdcd}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}input[type=date],input[type=email],input[type=number],input[type=password],input[type=search],input[type=text],select,textarea{border:1px solid #cdcdcd;box-sizing:border-box;border-radius:2px;background:#fff;color:#444;transition:border-color .2s ease}input[type=date]:active,input[type=date]:focus,input[type=email]:active,input[type=email]:focus,input[type=number]:active,input[type=number]:focus,input[type=password]:active,input[type=password]:focus,input[type=search]:active,input[type=search]:focus,input[type=text]:active,input[type=text]:focus,select:active,select:focus,textarea:active,textarea:focus{border-color:#4b9fd5;box-shadow:none;outline:0}input[type=date]:invalid,input[type=email]:invalid,input[type=number]:invalid,input[type=password]:invalid,input[type=search]:invalid,input[type=text]:invalid,select:invalid,textarea:invalid{box-shadow:none;outline:0}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#777}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:#777}input::placeholder,textarea::placeholder{color:#777}.is-valid>.Select-control,input[type=date].is-valid,input[type=email].is-valid,input[type=number].is-valid,input[type=password].is-valid,input[type=search].is-valid,input[type=text].is-valid,select.is-valid,textarea.is-valid{border-color:#0a0}.is-invalid>.Select-control,input[type=date].is-invalid,input[type=email].is-invalid,input[type=number].is-invalid,input[type=password].is-invalid,input[type=search].is-invalid,input[type=text].is-invalid,select.is-invalid,textarea.is-invalid{border-color:#d4333f}input.disabled,input:disabled,select.disabled,select:disabled,textarea.disabled,textarea:disabled{color:#bbb!important;border-color:#ddd!important;background:#ebebeb!important;cursor:not-allowed!important;pointer-events:none!important;box-shadow:none!important}input[type=date],input[type=email],input[type=number],input[type=password],input[type=search],input[type=text]{height:24px;padding:0 6px}input[type=search]{-webkit-appearance:textfield}input[type=search]::-webkit-search-decoration{-webkit-appearance:none}textarea{padding:3px}textarea.width-100{max-width:100%}textarea.fixed-width{resize:vertical}select{height:24px;line-height:24px}.input-tiny{width:60px!important}.input-small{width:100px!important}.input-medium{width:150px!important}.input-large{width:200px!important}.input-super-large{width:100%!important;max-width:300px;min-width:200px}.input-ghost{padding:0!important;border:none!important}.input-clear,.input-ghost{background-color:transparent!important}.input-code{font-family:Consolas,Liberation Mono,Menlo,Courier,monospace;font-size:12px}em.mandatory{color:#a4030f;font-style:italic}.form-field{clear:both;display:block;padding-b

It looks like you’ve probably passed the wrong URL to SONAR_HOST_URL – it should be the root URL of your SonarQube server. What URL have you used?

i made a change but the quality gate check is showing as an error…

Hey there.

Is SonarSource/sonarqube-scan-action now working? It looks like a parsing error – how is your GitHub Actions YAML now configured?

And, as mentioned before, please share logs in text-format, rather than screenshots of logs.

name: SonarQube Qualitygate check
on:
  # Trigger analysis when pushing in master or pull requests, and when creating
  # a pull request.
  workflow_dispatch: {} 
  push:
    branches:
      - development
  pull_request:
      types: [opened, synchronize, reopened]
jobs:
  sonarqube:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        # Disabling shallow clone is recommended for improving relevancy of reporting.
        fetch-depth: 0
    # Triggering SonarQube analysis as results of it are required by Quality Gate check.
    - name: SonarQube Scan
      uses: SonarSource/sonarqube-scan-action@master
      with:
        projectBaseDir: .
        args: >
          -Dsonar.projectKey=Token-Metrics-Scan 
          -Dsonar.sources=. 
          -Dsonar.host.url=https://sonarqube.tokenmetrics.com 
          -Dsonar.login=TOKEN
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

    # Check the Quality Gate status.
    - name: SonarQube Quality Gate check
      id: sonarqube-quality-gate-check
      uses: SonarSource/sonarqube-quality-gate-action@master 
      # Force to fail step after specific time.
      timeout-minutes: 10
      env:
        SONAR_TOKEN: ${{ secrets.TM_SONAR_TOKEN }}
        SONAR_HOST_URL: ${{ secrets.TM_SONAR_HOST_URL }}

this is the error i got >>

Run $GITHUB_ACTION_PATH/script/check-quality-gate.sh .scannerwork/report-task.txt
##[debug]/usr/bin/bash --noprofile --norc -e -o pipefail /home/runner/work/_temp/fafcec7e-20f6-4686-ae52-653fc69200f0.sh

#step:5:60)parse error: Invalid numeric literal at line 1, column 10
)Error: Process completed with exit code 4.
##[debug]Finished: run
##[debug]Evaluating: steps.quality-gate-check.outputs.quality-gate-status

##[debug]Evaluating Index:
##[debug]..Evaluating Index:
##[debug]....Evaluating Index:
##[debug]......Evaluating steps:
##[debug]......=> Object
##[debug]......Evaluating String:
#[debug]......=> 'quality-gate-check'
##[debug]....=> Object
##[debug]....Evaluating String:

##[debug]....=> 'outputs'
[debug]..=> Object

##[debug]..Evaluating String:

 'quality-gate-status'
 null
 null
##[debug]Finishing: SonarQube Quality Gate check