JSON tweaking for MD table.

This commit is contained in:
2024-12-19 14:34:58 -05:00
parent 741f7e47a9
commit f0e4f395e4
+15 -14
View File
@@ -88,11 +88,12 @@ jobs:
run: |
echo "Cleaning up quality gate response..."
echo '${{ steps.quality-gate-check.outputs.quality-gate-result }}' > qg_input.txt
cat qg_input.txt
sed -E 's/([a-zA-Z0-9_]+):/\\"\1\\":/g; s/:([^",{}\[\]]+)/:"\1"/g' qg_input.txt > qg_raw.json
jq -c '.' qg_raw.json > qg_fixed_json.json
projstatus=$(jq -r '.projectStatus.status' qg_fixed_json.json)
caycStatus=$(jq -r '.projectStatus.caycStatus' qg_fixed_json.json)
conditions=$(jq -r '.projectStatus.conditions' qg_fixed_json.json)
projstatus=$(jq '.projectStatus.status' qg_fixed_json.json)
caycStatus=$(jq '.projectStatus.caycStatus' qg_fixed_json.json)
conditions=$(jq '.projectStatus.conditions' qg_fixed_json.json)
echo "projstatus=${projstatus}" >> $GITHUB_OUTPUT
echo "caycStatus=${caycStatus}" >> $GITHUB_OUTPUT
echo "conditions=${conditions}" >> $GITHUB_OUTPUT
@@ -102,7 +103,7 @@ jobs:
id: convert-json-to-md
uses: buildingcash/json-to-markdown-table-action@v1.1.0
with:
json: ${{ toJSON(steps.json-cleanup.outputs.conditions) }}
json: ${{ steps.json-cleanup.outputs.conditions }}
# - name: Start Gitea-Sonarqube Bot
# uses: docker://justusbunsi/gitea-sonarqube-bot:v0.3.3
@@ -117,16 +118,16 @@ jobs:
# --repository my-org/my-repo
# --pull-request-id ${{ github.event.pull_request.number }}
- name: Post SonarQube Results as Comment
run: |
curl ${{ vars.RINOA_GITEA_URL }}/api/v1/repos/${{ github.repository }}/pulls/${{ steps.cc-pr.outputs.pr_index }}/reviews \
-X POST \
-H 'Accept: application/json' \
-H 'Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}' \
-H 'Content-Type: application/json' \
-d '{
"body": "SonarQube analysis results:\n\n${{ steps.convert-json-to-md.outputs.table }}\n\n${{ steps.quality-gate.outputs.quality-gate-status }}"
}'
# - name: Post SonarQube Results as Comment
# run: |
# curl ${{ vars.RINOA_GITEA_URL }}/api/v1/repos/${{ github.repository }}/pulls/${{ steps.cc-pr.outputs.pr_index }}/reviews \
# -X POST \
# -H 'Accept: application/json' \
# -H 'Authorization: token ${{ secrets.BOT_GITEA_TOKEN }}' \
# -H 'Content-Type: application/json' \
# -d '{
# "body": "SonarQube analysis results:\n\n${{ steps.convert-json-to-md.outputs.table }}\n\n${{ steps.quality-gate.outputs.quality-gate-status }}"
# }'
# Job 3: Merge PR if Quality Gate passes
# merge-pr: