Examples
Unique visitors instead of raw views
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} metric: views-unique label: 'Unique visitors' color: brightgreenClones counter
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} metric: clones label: 'Clones' color: orange output: clones.svgEmbed it:
Custom hex color
A 6-character hex (no leading #):
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} color: ff66ccLarge flat style
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} style: for-the-badge font-size: 14 abbreviated: trueLowercase label (shields.io style)
Most badges on shields.io render their label in lowercase. Pass
lowercase: true to match that look:
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} label: 'Repo views' lowercase: trueRenders the left side as repo views regardless of the casing you pass in
label. The for-the-badge style still uppercases (that’s part of the
style), so combining the two has no visible effect.
Migrating from another counter
If you already had a counter showing 5,000, preserve the displayed total:
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} base: 5000The base is added on top of the real Traffic-API total.
Multiple badges from one repo
Run the Action twice with different output filenames so the two badges live
side by side on the data branch:
jobs: views-badge: runs-on: ubuntu-latest steps: - uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} metric: views output: views.svg color: blue label: 'Views'
clones-badge: runs-on: ubuntu-latest steps: - uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} metric: clones output: clones.svg color: orange label: 'Clones'Custom branch name
If traffic-data collides with something in your repo, change it:
- uses: albertoarena/github-traffic-badge@v1 with: token: ${{ secrets.TRAFFIC_TOKEN }} branch: badge-dataThen point the README at the new branch:
