From 65d72d10c2f39272ba0c4e1bf4ad316fd473a947 Mon Sep 17 00:00:00 2001 From: "Trez.One" Date: Mon, 16 Dec 2024 21:55:16 -0500 Subject: [PATCH] JSON pre-processing tweaks. --- .../workflows/branch-sonarscan-pr-merge.yml | 99 ++++++++++--------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/.gitea/workflows/branch-sonarscan-pr-merge.yml b/.gitea/workflows/branch-sonarscan-pr-merge.yml index 5c5f82d3..30df7bad 100644 --- a/.gitea/workflows/branch-sonarscan-pr-merge.yml +++ b/.gitea/workflows/branch-sonarscan-pr-merge.yml @@ -54,65 +54,68 @@ jobs: with: input: ${{ steps.preprocess-response.outputs.response_json }} action: "get" - key: "" + key: "status" + - name: json-utils output + run: | + echo "${{ steps.parse-pr.outputs.result }}" # Step 2: Create PR if none exists - name: Create PR in Gitea - if: env.pr_exists == 'false' + if: ${{ steps.parse-pr.outputs.status == '404' }} id: create-pr uses: arifer612/Gitea-PR-action@v1.2.0 with: url: ${{ vars.RINOA_GITEA_URL }} token: ${{ secrets.GITEA_API_TOKEN }}" - # Job 2: Run SonarQube Analysis - sonarqube-analysis: - runs-on: ubuntu-latest - needs: check-and-create-pr - outputs: - quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }} - steps: - - name: Checkout Code - uses: actions/checkout@v4 + # # Job 2: Run SonarQube Analysis + # sonarqube-analysis: + # runs-on: ubuntu-latest + # needs: check-and-create-pr + # outputs: + # quality_gate_status: ${{ steps.quality-gate.outputs.quality-gate-status }} + # steps: + # - name: Checkout Code + # uses: actions/checkout@v4 - # Step 1: Run SonarQube Scan - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@v4.1.0 - env: - SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} - SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + # # Step 1: Run SonarQube Scan + # - name: SonarQube Scan + # uses: sonarsource/sonarqube-scan-action@v4.1.0 + # env: + # SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + # SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} - # Step 2: SonarQube Quality Gate Check - - name: SonarQube Quality Gate - id: quality-gate - uses: sonarsource/sonarqube-quality-gate-action@v1 - env: - SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} - SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} + # # Step 2: SonarQube Quality Gate Check + # - name: SonarQube Quality Gate + # id: quality-gate + # uses: sonarsource/sonarqube-quality-gate-action@v1 + # env: + # SONAR_HOST_URL: ${{ secrets.SONARQUBE_HOST }} + # SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} - - name: Log Quality Gate Result - run: | - echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}" + # - name: Log Quality Gate Result + # run: | + # echo "Quality Gate Status: ${{ steps.quality-gate.outputs.quality-gate-status }}" - # Job 3: Merge PR if Quality Gate passes - merge-pr: - runs-on: ubuntu-latest - needs: [check-and-create-pr, sonarqube-analysis] - if: needs.sonarqube-analysis.outputs.quality_gate_status == 'PASSED' - steps: - - name: Merge PR in Gitea - uses: prasiman/gocurl@v1 - with: - url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}" - method: "POST" - headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }' - params: >- - { - "Do": "merge", - "delete_branch_after_merge": true, - "force_merge": true, - "merge_when_checks_succeed": true - } + # # Job 3: Merge PR if Quality Gate passes + # merge-pr: + # runs-on: ubuntu-latest + # needs: [check-and-create-pr, sonarqube-analysis] + # if: needs.sonarqube-analysis.outputs.quality_gate_status == 'PASSED' + # steps: + # - name: Merge PR in Gitea + # uses: prasiman/gocurl@v1 + # with: + # url: "${{ secrets.GITEA_INSTANCE_URL }}/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/pulls/${{ needs.check-and-create-pr.outputs.pr_index }}" + # method: "POST" + # headers: '{ "Authorization": "token ${{ secrets.GITEA_API_TOKEN }}", "Content-Type": "application/json" }' + # params: >- + # { + # "Do": "merge", + # "delete_branch_after_merge": true, + # "force_merge": true, + # "merge_when_checks_succeed": true + # } - - name: Confirm Merge - run: echo "PR has been successfully merged into main." + # - name: Confirm Merge + # run: echo "PR has been successfully merged into main."