-
Notifications
You must be signed in to change notification settings - Fork 315
58 lines (57 loc) · 1.88 KB
/
go-ci-metrics.yaml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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