Skip to content

Commit add22e7

Browse files
feat(README): improved workflows
1 parent 742fcc9 commit add22e7

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

.github/workflows/metrics.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ on:
66
jobs:
77
build:
88
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
911
steps:
1012
- uses: lowlighter/metrics@latest
1113
with:
12-
filename: metrics.svg
14+
filename: profile/metrics.svg
1315
token: ${{ secrets.METRICS_TOKEN }} # fine-grained: read:org, read:public_repo
1416
user: ModioStudio
1517
template: classic
1618
base: header, repositories
1719
config_timezone: Europe/Berlin
20+
- uses: stefanzweifel/git-auto-commit-action@v5
21+
with:
22+
commit_message: "chore: update org metrics"
23+
file_pattern: "profile/metrics.svg"

.github/workflows/org-stars-badge.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Auth GH CLI
12-
run: echo "${{ secrets.ORG_TOKEN }}" | gh auth login --with-token
11+
- name: Setup auth
12+
env:
13+
GH_TOKEN: ${{ secrets.ORG_TOKEN }}
14+
run: gh auth status || true
1315
- name: Compute total stars
1416
id: stars
1517
env:
@@ -18,12 +20,14 @@ jobs:
1820
# sum stargazers_count over all repos (public + private if token allows)
1921
TOTAL=$(gh api -H "X-GitHub-Api-Version: 2022-11-28" /orgs/$ORG/repos --paginate -q '.[].stargazers_count' | awk '{s+=$1} END{print s+0}')
2022
echo "total=$TOTAL" >> $GITHUB_OUTPUT
21-
- name: Publish badge json to Gist
22-
uses: schneegans/dynamic-badges-action@v1.7.0
23+
- name: Write badge JSON
24+
run: |
25+
mkdir -p profile
26+
cat > profile/org-stars.json <<EOF
27+
{"schemaVersion":1,"label":"Stars","message":"${{ steps.stars.outputs.total }}","color":"yellow"}
28+
EOF
29+
- name: Commit badge JSON
30+
uses: stefanzweifel/git-auto-commit-action@v5
2331
with:
24-
auth: ${{ secrets.GIST_TOKEN }}
25-
gistID: GIST_ID_HERE
26-
filename: org-stars.json
27-
label: Stars
28-
message: ${{ steps.stars.outputs.total }}
29-
color: yellow
32+
commit_message: "chore: update org stars badge"
33+
file_pattern: "profile/org-stars.json"

profile/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div align="center">
1111
<img src="https://img.shields.io/badge/dynamic/json?label=Repos&query=%24.public_repos&url=https%3A%2F%2Fapi.github.com%2Forgs%2FModioStudio&logo=github&color=blue&cacheSeconds=3600" style="margin:0 6px;vertical-align:middle;" />
1212
<img src="https://visitor-badge.laobi.icu/badge?page_id=ModioStudio&left_text=Visitors" style="margin:0 6px;vertical-align:middle;" />
13-
<img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/GITHUB_USER_HERE/GIST_ID_HERE/raw/org-stars.json&logo=github&label=Stars&color=yellow&cacheSeconds=3600" style="margin:0 6px;vertical-align:middle;" />
13+
<img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/ModioStudio/.github/main/profile/org-stars.json&logo=github&label=Stars&color=yellow&cacheSeconds=3600" style="margin:0 6px;vertical-align:middle;" />
1414
</div>
1515

1616
###

0 commit comments

Comments
 (0)