Skip to content

Commit 79b82b6

Browse files
committed
initial go port
1 parent d0fb05e commit 79b82b6

14 files changed

Lines changed: 389 additions & 1309 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build Generator Binary
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v6
12+
13+
- uses: actions/setup-go@v61
14+
15+
- name: Build Linux binary
16+
run: |
17+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
18+
go build -o bin/linux-amd64 ./cmd/generate
19+
20+
- name: Commit updated binary
21+
run: |
22+
git config --global user.name "github-stats[bot]"
23+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
24+
25+
git add bin/linux-amd64
26+
git commit -m "Update generator binary" || echo
27+
git push

.github/workflows/main.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,10 @@ jobs:
2323
# Checks-out repository under $GITHUB_WORKSPACE, so the job can access it
2424
- uses: actions/checkout@v6
2525

26-
# Set up UV to manage Python versions
27-
- name: Install uv and set python version
28-
uses: astral-sh/setup-uv@v7
29-
with:
30-
enable-cache: true
31-
python-version: '3.12'
32-
33-
# Generate all statistics images
34-
- name: Generate images
35-
run: uv run generate_images.py
26+
- name: Run generator
27+
run: |
28+
chmod +x bin/linux-amd64
29+
bin/linux-amd64
3630
env:
3731
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
3832
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cmd/generate/main.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package main
2+
3+
import (
4+
"context"
5+
"log"
6+
"os"
7+
8+
"github.com/botblake/github-stats-transparent/internal/github"
9+
"github.com/botblake/github-stats-transparent/internal/render"
10+
"github.com/botblake/github-stats-transparent/internal/stats"
11+
)
12+
13+
func main() {
14+
token := os.Getenv("ACCESS_TOKEN")
15+
user := os.Getenv("GITHUB_ACTOR")
16+
17+
if token == "" || user == "" {
18+
log.Fatal("ACCESS_TOKEN and GITHUB_ACTOR must be set")
19+
}
20+
21+
client := github.NewClient(user, token, 10)
22+
s := stats.NewStats(user, client)
23+
24+
ctx := context.Background()
25+
if err := s.Collect(ctx); err != nil {
26+
log.Fatal(err)
27+
}
28+
29+
if err := render.GenerateOverview(s); err != nil {
30+
log.Fatal(err)
31+
}
32+
if err := render.GenerateLanguages(s); err != nil {
33+
log.Fatal(err)
34+
}
35+
}

generate_images.py

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)