-
-
Notifications
You must be signed in to change notification settings - Fork 182
37 lines (33 loc) · 1.28 KB
/
pana_analysis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Pana Analysis
on: [pull_request, workflow_dispatch]
jobs:
package-analysis:
runs-on: ubuntu-latest
if: github.base_ref != 'customer_testing'
steps:
- uses: actions/checkout@v3
- uses: axel-op/dart-package-analyzer@v3
# set an id for the current step
id: analysis
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
# You can then use this id to retrieve the outputs in the next steps.
# The following step shows how to exit the workflow with an error if the total score in percentage is below 50:
- name: Check scores
env:
# NB: "analysis" is the id set above. Replace it with the one you used if different.
TOTAL: ${{ steps.analysis.outputs.total }}
TOTAL_MAX: ${{ steps.analysis.outputs.total_max }}
run: |
PERCENTAGE=$(( $TOTAL * 100 / $TOTAL_MAX ))
if (( $PERCENTAGE < 80 ))
then
echo Score too low!
exit 1
fi
# This step is useful for PR's coming from forks. It takes the raw JSON and formats a report from it.
- name: Format scores json
env:
JSON_OUTPUT: ${{ steps.analysis.outputs.json_output }}
run: |
TOTAL_SCORE=$(jq -r '.scores.grantedPoints' <<< "$JSON_OUTPUT")