File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : " Publish Sonar JSON to Pixee"
2+ on :
3+ check_run :
4+ types : [completed]
5+
6+ permissions :
7+ contents : read
8+ id-token : write
9+
10+ jobs :
11+ publish :
12+ name : " Publish Sonar JSON to Pixee"
13+ runs-on : ubuntu-latest
14+ if : ${{ github.event.check_run.name == 'SonarCloud Code Analysis' }}
15+ steps :
16+ - name : " Publish Sonar JSON to Pixee"
17+ shell : bash
18+ env :
19+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
20+ run : |
21+ PR_NUMBER=${{ join(github.event.check_run.pull_requests.*.number, '') }}
22+ URL="https://sonarcloud.io/api/issues/search?componentKeys=pixee_codemodder-python&resolved=false"
23+
24+ if [ -n "$PR_NUMBER" ]; then
25+ URL="${URL}&pullRequest=$PR_NUMBER"
26+ fi
27+
28+ curl -v "$URL" -o sonar_issues.json
29+ cat sonar_issues.json
30+ ANALYSIS_SHA=${{ github.event.check_run.head_sha }}
31+ SECRET=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://app.pixee.ai" | jq -j '.value')
32+ API_RESPONSE=$(curl -v -X PUT -H "Authorization: Bearer $SECRET" -H "Content-Type: multipart/form-data" -F "file=@sonar_issues.json" "https://api.pixee.ai/analysis-input/pixee/codemodder-python/$ANALYSIS_SHA/sonar")
33+ echo "$API_RESPONSE"
34+
35+ - name : " Trigger Pixee Analysis"
36+ if : ${{ toJson(github.event.check_run.pull_requests) != '[]' }}
37+ run : |
38+ SECRET=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://app.pixee.ai" | jq -j '.value')
39+ API_RESPONSE=$(curl -v -X POST -H "Authorization: Bearer $SECRET" "https://api.pixee.ai/analysis-input/pixee/codemodder-python/${{ github.event.check_run.pull_requests[0].number }}")
40+ echo $API_RESPONSE
You can’t perform that action at this time.
0 commit comments