Skip to content

Commit d52726b

Browse files
marzagaoclaude
andcommitted
ci: auto-bump GRC badge cache-buster on Go changes
GitHub's camo image proxy caches README image URLs aggressively, which can leave the GRC badge showing a stale "error" state even after the upstream report has recovered. A new workflow rewrites the badge URL's ?v= query param to the current commit SHA on any push that touches Go sources, forcing camo to re-fetch. Also adds a package doc comment on cmd/root.go and triggers the first bump. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 958a1ed commit d52726b

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Bump GRC badge cache-buster
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '**/*.go'
8+
- 'go.mod'
9+
- 'go.sum'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
bump:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
20+
- name: Rewrite badge URL with current SHA
21+
run: |
22+
sed -i -E \
23+
's|(goreportcard\.com/badge/github\.com/marzagao/aquadirector)\?v=[^)"]*|\1?v=${{ github.sha }}|g' \
24+
README.md
25+
26+
- name: Commit if changed
27+
run: |
28+
if git diff --quiet README.md; then
29+
echo "README already up to date"
30+
exit 0
31+
fi
32+
git config user.name 'github-actions[bot]'
33+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
34+
git add README.md
35+
git commit -m 'chore: bump GRC badge cache-buster [skip ci]'
36+
git push

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Monitor and control your reef aquarium from the terminal — all on your local network, no cloud required.
44

5-
[![Go](https://img.shields.io/badge/Go-1.25+-00ADD8?logo=go)](https://go.dev) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![CI](https://github.com/marzagao/aquadirector/actions/workflows/ci.yml/badge.svg)](https://github.com/marzagao/aquadirector/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/marzagao/aquadirector)](https://goreportcard.com/report/github.com/marzagao/aquadirector)
5+
[![Go](https://img.shields.io/badge/Go-1.25+-00ADD8?logo=go)](https://go.dev) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![CI](https://github.com/marzagao/aquadirector/actions/workflows/ci.yml/badge.svg)](https://github.com/marzagao/aquadirector/actions/workflows/ci.yml) [![Go Report Card](https://goreportcard.com/badge/github.com/marzagao/aquadirector?v=init)](https://goreportcard.com/report/github.com/marzagao/aquadirector)
66

77
<img src="hack/demo.svg" width="600" alt="Demo" />
88

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package cmd implements the aquadirector CLI commands.
12
package cmd
23

34
import (

0 commit comments

Comments
 (0)