|
|
|
@@ -15,9 +15,19 @@ class Api::V1::SonarqubesController < Api::V1::BaseController |
|
|
|
end |
|
|
|
|
|
|
|
def insert_file |
|
|
|
checkout_url = 'https://gitlink.org.cn/KingChan/checkout@v4' |
|
|
|
scanner_url = 'https://gitlink.org.cn/KingChan/sonarqube-scan-action@master' |
|
|
|
begin |
|
|
|
config = Rails.application.config_for(:configuration) |
|
|
|
sonarqube_config = config.dig('sonarqube') |
|
|
|
|
|
|
|
if sonarqube_config.present? && sonarqube_config['checkout'].present? |
|
|
|
checkout_url = sonarqube_config['checkout'] |
|
|
|
end |
|
|
|
if sonarqube_config.present? && sonarqube_config['scanner'].present? |
|
|
|
scanner_url = sonarqube_config['scanner'] |
|
|
|
end |
|
|
|
|
|
|
|
raise 'sonar config missing' if sonarqube_config.blank? |
|
|
|
rescue => ex |
|
|
|
raise ex if Rails.env.production? |
|
|
|
@@ -47,12 +57,12 @@ class Api::V1::SonarqubesController < Api::V1::BaseController |
|
|
|
sonarqube: |
|
|
|
runs-on: ubuntu-latest |
|
|
|
steps: |
|
|
|
- uses: #{sonarqube_config['checkout']} |
|
|
|
- uses: #{checkout_url} |
|
|
|
with: |
|
|
|
# Disabling shallow clones is recommended for improving the relevancy of reporting |
|
|
|
fetch-depth: 0 |
|
|
|
- name: SonarQube Scan |
|
|
|
uses: #{sonarqube_config['scanner']} |
|
|
|
uses: #{scanner_url} |
|
|
|
env: |
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
|
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |
|
|
|
|