Switching back to gocurl for PR comment.

This commit is contained in:
2024-11-30 15:40:12 -05:00
parent 10c7e5923c
commit 7b32c944e3
+43 -44
View File
@@ -17,45 +17,18 @@ jobs:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0
# - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v4.0.0
# env:
# SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
# SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4.0.0
env:
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
# - name: Fetch SonarQube Project Status
# id: fetch-status
# uses: prasiman/gocurl@v1
# with:
# method: GET
# url: ${{ secrets.SONARQUBE_URL }}/api/qualitygates/project_status
# basic-auth-token: ${{ secrets.SONARQUBE_TOKEN }}
# params: '{{ "projectKey", "${{ gitea.repository.name }}" }}'
# log-response: true
# - name: Comment on PR with SonarQube Status
# uses: prasiman/gocurl@v1
# with:
# method: "POST"
# url: ${{ secrets.RINOA_GITEA_SERVER }}/api/v1/repos/${{ gitea.repository.owner.login }}/${{ gitea.repository.name }}/pulls/${{ gitea.pull_request.id }}/reviews
# headers: |
# Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}
# Content-Type: application/json
# body:
# |
# {
# "body": "string",
# "comments": [
# {
# "body": "${{ steps.quality-gate.outputs.quality-gate-status }}",
# "new_position": 0,
# "old_position": 0,
# "path": "string"
# }
# ],
# "commit_id": "${{ gitea.pull_request.head.sha }}",
# "event": "COMMENT"
# }
- name: SonarQube Quality Gate Check
id: quality-gate
uses: SonarSource/sonarqube-quality-gate-action@v1.1.0
env:
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
- name: Run SonarQube and Gitea Action
uses: https://git.trez.wtf/Trez.One/sonar-gitea-pr-bot@v1.0.2
@@ -67,12 +40,38 @@ jobs:
project_key: ${{ gitea.repository.name }}
pull_request_id: ${{ gitea.event.pull_request.number }}
- name: SonarQube Quality Gate Check
id: quality-gate
uses: SonarSource/sonarqube-quality-gate-action@v1.1.0
env:
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
# - name: Fetch SonarQube Project Status
# id: fetch-status
# uses: prasiman/gocurl@v1
# with:
# method: GET
# url: ${{ secrets.SONARQUBE_URL }}/api/qualitygates/project_status
# basic-auth-token: ${{ secrets.SONARQUBE_TOKEN }}
# params: '{{ "projectKey", "${{ gitea.repository.name }}" }}'
# log-response: true
- name: Comment on PR with SonarQube Status
uses: prasiman/gocurl@v1
with:
method: POST
url: ${{ secrets.RINOA_GITEA_SERVER }}/api/v1/repos/${{ gitea.repository.owner.login }}/${{ gitea.repository.name }}/pulls/${{ gitea.pull_request.id }}/reviews
headers: |
Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}
Content-Type: application/json
body: >
{
"body": "SonarQube Quality Gate Status",
"comments": [
{
"body": "${{ steps.quality-gate.outputs.quality-gate-status }}",
"new_position": 0,
"old_position": 0
}
],
"commit_id": "${{ gitea.pull_request.head.sha }}",
"event": "COMMENT"
}
# - name: SonarQube Pull Request Comment
# if: always()