JSON formatting fix...
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
"body": "This is an automated PR created by Gitea Actions.",
|
||||
"base": "main",
|
||||
"head": "${{ github.ref_name }}"
|
||||
}' -s | jq '{index: .number}' > pr_created.json
|
||||
}' | jq '{index: .number}' > pr_created.json
|
||||
echo "pr_created=$(jq -c . pr_created.json)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Job 2: Run SonarQube Analysis
|
||||
@@ -80,27 +80,36 @@ jobs:
|
||||
sonar-project-key: rinoa-docker
|
||||
sonar-host-url: ${{ secrets.SONARQUBE_HOST }}
|
||||
sonar-token: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
|
||||
- name: Check Quality Gate Status
|
||||
id: check-quality-gate-status
|
||||
run: |
|
||||
echo "Quality Gate Status: ${{ steps.quality-gate-check.outputs.project-status }}"
|
||||
echo "Quality Gate Result: "
|
||||
echo "${{ steps.quality-gate-check.outputs.quality-gate-result }}" > input.txt
|
||||
sed -E 's/([^,{:]*):/\1":/g; s/: ([^,}\]]*)/: "\1"/g' input.txt | sed 's/,\s*}/}/g; s/,\s*\]/]/g' > fixed.json
|
||||
jq '.' fixed.json
|
||||
cat fixed.json
|
||||
echo "quality-gate-report=$(cat fixed.json)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Convert JSON report to markdown
|
||||
id: convert-json-to-md
|
||||
uses: parkerbxyz/json-to-markdown-table@v1.1.2
|
||||
with:
|
||||
json: toJSON(${{ steps.quality-gate-check.outputs.quality-gate-result }})
|
||||
|
||||
- name: Verify markdown output
|
||||
- name: Create Input File
|
||||
run: |
|
||||
echo "${{ steps.convert-json-to-md.outputs.table }}"
|
||||
echo "Creating invalid input..."
|
||||
cat <<EOF > input.txt
|
||||
${{ steps.quality-gate-check.outputs.quality-gate-result }}
|
||||
EOF
|
||||
|
||||
- name: Fix JSON Formatting
|
||||
id: fix-json
|
||||
run: |
|
||||
echo "Fixing invalid JSON..."
|
||||
sed -E 's/([^,{:]*):/\1":/g; s/: ([^,}\]]*)/: "\1"/g' input.txt | \
|
||||
sed 's/,\s*}/}/g; s/,\s*\]/]/g' > fixed.json
|
||||
cat fixed.json
|
||||
|
||||
- name: Validate Fixed JSON
|
||||
run: |
|
||||
echo "Validating JSON with jq..."
|
||||
jq '.' fixed.json
|
||||
|
||||
# - name: Convert JSON report to markdown
|
||||
# id: convert-json-to-md
|
||||
# uses: parkerbxyz/json-to-markdown-table@v1.1.2
|
||||
# with:
|
||||
# json: toJSON(${{ steps.quality-gate-check.outputs.quality-gate-result }})
|
||||
|
||||
# - name: Verify markdown output
|
||||
# run: |
|
||||
# echo "${{ steps.convert-json-to-md.outputs.table }}"
|
||||
|
||||
# Step 2: Post SonarQube results as comment (using curl commands and Gitea API)
|
||||
# - name: Post SonarQube Results as Comment
|
||||
|
||||
Reference in New Issue
Block a user