Skip to content

Merge pull request #6694 from Checkmarx/kics-1031 #1614

Merge pull request #6694 from Checkmarx/kics-1031

Merge pull request #6694 from Checkmarx/kics-1031 #1614

name: go-ci-metrics
on:
workflow_dispatch:
push:
branches: [master]
paths:
- "assets/queries/**/metadata.json"
jobs:
metrics:
name: test-metrics
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Run test metrics script
id: metrics
run: |
pip3 install -r .github/scripts/metrics/requirements.txt
python3 .github/scripts/metrics/get_metrics.py
- name: Generate badge
run: |
curl -L \
https://img.shields.io/badge/Queries-${{ steps.metrics.outputs.total_queries }}-blue.svg > queries.svg
cat queries.svg
- uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-queries-badge-latest
path: queries.svg
publish:
name: publish-metrics
runs-on: ubuntu-latest
needs: metrics
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Configure git commit author
run: |
git config --global user.name "KICSBot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Download Queries Badge SVG
uses: actions/download-artifact@master
with:
name: ${{ runner.os }}-queries-badge-latest
path: latest-metrics
- name: Generate badge
run: |
mv latest-metrics/queries.svg queries.svg
git add queries.svg
if ! git status | grep "nothing to commit"; then
git commit -m 'chore(metrics): updating queries count badge'
git push origin gh-pages
fi