Merge pull request #1547 from spidernet-io/fix-trivy #709
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Badge Status | |
# ====modify==== | |
env: | |
CODESTATUSSCRIPT: "./tools/golang/codeCoverage.sh" | |
BADGE_CODELINE_FILENAME: | |
BADGE_CODELINE_ID: | |
BADGE_COMMENT_FILENAME: | |
BADGE_COMMENT_ID: | |
E2ECOVERSTATUSSCRIPT: "./tools/golang/e2ecover.sh" | |
BADGE_E2ECOVER_FILENAME: egressgatewaye2e.json | |
BADGE_E2ECOVER_ID: cc6d42eb27d8ee4c3d19c936eff2c478 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
update-badges: | |
name: Update Badges | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download cloc | |
run: sudo apt-get update -y && sudo apt-get install -y cloc | |
- name: Get the Numbers | |
shell: bash | |
run: | | |
TOOL_PATH=${{ env.CODESTATUSSCRIPT }} | |
CODE_LINES=$( ${TOOL_PATH} --code-lines ) | |
COMMENT_PERCENTAGE=$( ${TOOL_PATH} --comment-percent ) | |
echo "CODE_LINES=${CODE_LINES}" >> $GITHUB_ENV | |
echo "COMMENT_PERCENTAGE=${COMMENT_PERCENTAGE}" >> $GITHUB_ENV | |
TOOL_PATH=${{ env.E2ECOVERSTATUSSCRIPT }} | |
E2E_STATUS=$( ${TOOL_PATH} ) | |
echo "E2E_STATUS=${E2E_STATUS}" >> $GITHUB_ENV | |
- name: Create Lines-of-Code-Badge | |
if: ${{ env.BADGE_CODELINE_ID != '' }} | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.WELAN_PAT }} | |
gistID: ${{ env.BADGE_CODELINE_ID }} | |
filename: ${{ env.BADGE_CODELINE_FILENAME }} | |
label: Code Lines | |
message: ${{ env.CODE_LINES }} | |
color: lightgrey | |
- name: Create Comments-Badge | |
if: ${{ env.BADGE_COMMENT_LINE != '' }} | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.WELAN_PAT }} | |
gistID: ${{ env.BADGE_COMMENT_LINE }} | |
filename: ${{ env.BADGE_COMMENT_FILENAME }} | |
label: Comments | |
message: ${{ env.COMMENT_PERCENTAGE }}% | |
valColorRange: ${{ env.COMMENT_PERCENTAGE }} | |
maxColorRange: 100 | |
minColorRange: 0 | |
- name: Create E2E-Badge | |
if: ${{ env.BADGE_E2ECOVER_ID != '' }} | |
uses: schneegans/dynamic-badges-action@v1.7.0 | |
with: | |
auth: ${{ secrets.WELAN_PAT }} | |
gistID: ${{ env.BADGE_E2ECOVER_ID }} | |
filename: ${{ env.BADGE_E2ECOVER_FILENAME }} | |
label: e2e cover | |
message: ${{ env.E2E_STATUS }} | |
color: lightgrey | |