Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 33 additions & 9 deletions .github/workflows/copilot_metrics_retention.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,48 @@

on:
push:

schedule:
- cron: '0 0 * * 0'
# This cron expression runs the workflow every Sunday at midnight UTC
permissions:
contents: write
id-token: write
pull-requests: write
actions: write

jobs:
first-job:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Copilot Metrics Retention
uses: ambilykk/copilot-metrics-retention@main
with:
- name: Copilot Metrics Retention
uses: ambilykk/copilot-metrics-retention@5b9ef15ce66fc883afb3b6127f960e44d5233a50
with:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
org_name: 'hivemq'
json_path: 'metrics.json'

json_path: 'metrics_hivemq.json'

- name: Copilot Metrics Retention
uses: ambilykk/copilot-metrics-retention@5b9ef15ce66fc883afb3b6127f960e44d5233a50
with:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
org_name: 'hivemq-cloud'
json_path: 'metrics_hivemq-cloud.json'

- uses: actions/upload-artifact@v4
with:
name: metrics.json
path: 'metrics.json'

path: |
metrics_hivemq.json
metrics_hivemq-cloud.json

- name: Commit and push if it changed
run: |
git config user.name 'Copilot Metrics Retention'
git config user.email 'action@github.com'
git add metrics_hivemq.json metrics_hivemq-cloud.json
git commit -m "Copilot Metrics data update" || exit 0
git push
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ GitHub only offers a 28-day retention period for Copilot metrics. This solution
A GitHub Action retrieves the JSON metrics and renders them into a single JSON file. [Ref](*https://github.com/marketplace/actions/copilot-metrics-retention)

## Convert the json into SQlite dbfile
Open the terminal into the repo folder and run `python3 app.py`, visit the page `http://127.0.0.1:5000/`, download the json artifact and load the file, click on `Convert & Download SQLite DB`, this will generate a .db file available under the upload folder having the name `copilot_metrics.db`
Open the terminal into the repo folder and run `python3 app.py`, visit the page `http://127.0.0.1:5000/`.
Load the `metrics.json`, click on `Convert & Download SQLite DB`, this will generate a .db file available under the upload folder having the name `copilot_metrics.db`

## Visualite the copilot_metrics.db via metabase

Expand Down
Loading