@@ -24,40 +24,45 @@ jobs:
2424 run : poetry install --no-interaction --no-root
2525
2626 - name : Test
27+ id : test
2728 run : |
2829 poetry run pytest --cov=commitomatic --cov-report=xml
2930 curl https://deepsource.io/cli | sh
3031 ./bin/deepsource report --analyzer test-coverage --key python --value-file $PWD/coverage.xml
3132 rate=$(grep -Pio 'line-rate="\K[^"]*' coverage.xml | head -n1)
3233 percentage=$(echo "100 * $rate" | bc)
3334 percentage_rounded=$(printf "%.f" $percentage)
34- echo "lines=${percentage_rounded}" >> $GITHUB_OUTPUT
35+ echo "lines=${percentage_rounded}% " >> $GITHUB_OUTPUT
3536 echo "path=${BADGE_PATH}" >> $GITHUB_OUTPUT
3637 echo "branch=badges" >> $GITHUB_OUTPUT
3738 env :
3839 DEEPSOURCE_DSN : ${{ secrets.DEEPSOURCE_DSN }}
39- BADGE_PATH : ${{ steps.extract_branch.outputs.branch }}/test-badge.svg
40+ BADGE_PATH : test-coverage.svg
41+
42+ - uses : actions/checkout@v3
43+ with :
44+ ref : badges
4045
4146 - name : Generate the badge SVG image
4247 uses : emibcn/badge-action@v2.0.2
4348 id : badge
4449 with :
4550 label : ' Test coverage'
46- status : ${{ steps.coverage .outputs.lines }}
51+ status : ${{ steps.test .outputs.lines }}
4752 color : ' blue,555,daf'
48- path : ${{ steps.coverage .outputs.path }}
53+ path : ${{ steps.test .outputs.path }}
4954
5055 - name : Upload badge as artifact
5156 uses : actions/upload-artifact@v3
5257 with :
5358 name : badge
54- path : ${{ steps.coverage .outputs.path }}
59+ path : ${{ steps.test .outputs.path }}
5560 if-no-files-found : error
5661
5762 - name : Commit badge
5863 continue-on-error : true
5964 env :
60- BADGE : ${{ steps.coverage .outputs.path }}
65+ BADGE : ${{ steps.test .outputs.path }}
6166 run : |
6267 git config --local user.email "action@github.com"
6368 git config --local user.name "GitHub Action"
6974 if : ${{ success() }}
7075 with :
7176 github_token : ${{ secrets.GITHUB_TOKEN }}
72- branch : ${{ steps.coverage .outputs.branch }}
77+ branch : ${{ steps.test .outputs.branch }}
0 commit comments