Skip to content

Merge pull request #7153 from julianthome/patch-1 #1686

Merge pull request #7153 from julianthome/patch-1

Merge pull request #7153 from julianthome/patch-1 #1686

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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- 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@0b2256b8c012f0828dc542b3febcab082c67f72b # v4
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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@v4
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