Skip to content

Commit

Permalink
Merge pull request #69 from nf-core/stats
Browse files Browse the repository at this point in the history
Steampipe PoC
  • Loading branch information
edmundmiller authored Sep 9, 2024
2 parents 76f3a92 + 317bb8e commit dbbb33d
Show file tree
Hide file tree
Showing 12 changed files with 991 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Stats

on:
schedule: # every day at 2am and 2pm
- cron: "0 2,14 * * *"
pull_request:
paths:
- "stats/steampipe/**"
workflow_dispatch:
repository_dispatch:
types: [update-website]

env:
TWITTER_BEARER_TOKEN: ${{secrets.TWITTER_BEARER_TOKEN}}
GITHUB_TOKEN: ${{secrets.STEAMPIPE_GH_TOKEN}}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}

jobs:
update:
name: Update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
cache: true
manifest-path: "stats/steampipe/pixi.toml"
- run: pixi run download_hf
working-directory: ./stats/steampipe/
- run: pixi run plugins
working-directory: ./stats/steampipe/
# FIXME Throw error if failure to connect
- run: pixi run github_hc
working-directory: ./stats/steampipe/
- run: pixi run twitter_hc
working-directory: ./stats/steampipe/
- run: pixi run slack_hc
working-directory: ./stats/steampipe/
# TODO - run: pixi run slack
- run: pixi run upload_hf
working-directory: ./stats/steampipe/
8 changes: 8 additions & 0 deletions stats/steampipe/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
watch_file pixi.lock
eval "$(pixi shell-hook)"

export OP_ACCOUNT="nf-core"
export TWITTER_BEARER_TOKEN=$(op read "op://Shared/3yyagrpjil6orirpdr7xslerfi/Bearer token")
# export GITHUB_TOKEN=$(op read "op://Private/GitHub Personal Access Token/token")
# export HF_TOKEN=$(op read "op://Private/Hugging Face API Token/user access token")
export SLACK_TOKEN=$(op read "op://Employee/Slack Steampipe CLI OAuth Token/credential")
2 changes: 2 additions & 0 deletions stats/steampipe/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions stats/steampipe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# pixi environments
.pixi
*.egg-info
hf_stats/
14 changes: 14 additions & 0 deletions stats/steampipe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
![GitHub Stats](https://img.shields.io/endpoint?url=https%3A%2F%2Fhealthchecks.io%2Fb%2F2%2Fd2febac8-1214-4c89-aa9c-a3f2c77b3995.shields)
![Twitter Stats](https://img.shields.io/endpoint?url=https%3A%2F%2Fhealthchecks.io%2Fb%2F2%2F5fd77e2f-16ea-4514-bd06-a49e710aab37.shields)

## Notes

https://steampipe.io/docs/integrations/gitpod
https://steampipe.io/docs/integrations/github_actions/installing_steampipe

https://hub.steampipe.io/plugins/turbot/github

## Plans

Okay so first we're going to go from Steam pipe and then Steam pipe will then run these
queries that'll all get kicked off by GitHub Actions cronjob and that cron job will run a healthcheck ping at the end, and if it doesn't ping it'll hit us with a slack notification
14 changes: 14 additions & 0 deletions stats/steampipe/github.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
select
followers,
teams_total_count as teams_count,
members_with_role_total_count as member_count,
repositories_total_count as repo_count,
repositories_total_disk_usage as disk_usage
from
github_organization
where
login = 'nf-core';

-- https://hub.steampipe.io/plugins/turbot/github/tables/github_organization_collaborator
-- https://hub.steampipe.io/plugins/turbot/github/tables/github_stargazer
-- https://hub.steampipe.io/plugins/turbot/github/tables/github_traffic_view_daily
Loading

0 comments on commit dbbb33d

Please sign in to comment.