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 # Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0 fetch-depth: 0
# - name: SonarQube Scan - name: SonarQube Scan
# uses: SonarSource/sonarqube-scan-action@v4.0.0 uses: SonarSource/sonarqube-scan-action@v4.0.0
# env: env:
# SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
# SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
# - name: Fetch SonarQube Project Status - name: SonarQube Quality Gate Check
# id: fetch-status id: quality-gate
# uses: prasiman/gocurl@v1 uses: SonarSource/sonarqube-quality-gate-action@v1.1.0
# with: env:
# method: GET SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }}
# url: ${{ secrets.SONARQUBE_URL }}/api/qualitygates/project_status SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
# 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: Run SonarQube and Gitea Action - name: Run SonarQube and Gitea Action
uses: https://git.trez.wtf/Trez.One/sonar-gitea-pr-bot@v1.0.2 uses: https://git.trez.wtf/Trez.One/sonar-gitea-pr-bot@v1.0.2
@@ -67,12 +40,38 @@ jobs:
project_key: ${{ gitea.repository.name }} project_key: ${{ gitea.repository.name }}
pull_request_id: ${{ gitea.event.pull_request.number }} pull_request_id: ${{ gitea.event.pull_request.number }}
- name: SonarQube Quality Gate Check # - name: Fetch SonarQube Project Status
id: quality-gate # id: fetch-status
uses: SonarSource/sonarqube-quality-gate-action@v1.1.0 # uses: prasiman/gocurl@v1
env: # with:
SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} # method: GET
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} # 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 # - name: SonarQube Pull Request Comment
# if: always() # if: always()