You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Traffic to Badge
v1.1.5
The GitHub action that using repositories Insights/traffic
data to generate badges that include views and clones.
- ⚡️ Traffic to Badge GitHub Action
- 🎨 Table of contents
- 🚀 Action configuration
- 📝 Example usage
- 📝 Use dependabot to keep action up-to-date
- 🙈 Generate
my_token
- 🔊 CHANGELOG
- 📄 LICENSE
- 🎉 Thanks
inputs:
my_token:
description: >
Set up a personal access token to obtain the secret repository traffic data.
required: true
static_list:
description: >
Set up a list of repositories to get.
Only when github.repository with setting into first item,
it can be correct to be current repository name.
required: false
default: ${{ github.repository }}
traffic_branch:
description: >
If empty traffic data will be backed up to the branch named traffic.
required: false
default: traffic
views_color:
description: >
Set a hex or named color value for the views badge background.
required: false
default: brightgreen
clones_color:
description: >
Set a hex or named color value for the clones badge background.
required: false
default: brightgreen
logo:
description: >
Insert a named logo or simple-icon to the left of the label.
required: false
default: github
outputs:
traffic_branch:
description: >
Origin traffic data branch name
traffic_path:
description: >
Path to generate traffic data
name: traffic2badge
on:
push:
branches:
- main
schedule:
- cron: '1 0 * * *' #UTC
jobs:
run:
name: Make GitHub Traffic to Badge
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2.3.3
- name: Get Traffic
id: traffic
uses: yi-Xu-0100/traffic-to-badge@v1.1.5
with:
my_token: ${{ secrets.TRAFFIC_TOKEN }}
#(default) static_list: ${{ github.repository }}
#(default) traffic_branch: traffic
#(default) views_color: brightgreen
#(default) clones_color: brightgreen
#(default) logo: github
- name: Show Traffic Data
run: |
echo ${{ steps.traffic.outputs.traffic_branch }}
echo ${{ steps.traffic.outputs.traffic_path }}
cd ${{ steps.traffic.outputs.traffic_path }}
ls -a
More usage example:
yi-Xu-0100/traffic2badge
- Template repository for usage withyi-Xu-0100/repo-list-generator
which generaterepoList
forstatic_list
.
This file is build in ./github/dependabot.yml
to keep action up-to-date.
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
This part is obtained from
sangonzal/repository-traffic-action
.
You'll first need to create a personal access token (PAT) which make the action having the access to the GitHub API.
You can generate a PAT by going to Settings(GitHub) -> Developer Settings -> Personal Access Tokens -> Generate new token
, and will need to grant repo
permission. For more information, see the GitHub documentation.
After you generated the PAT, go to Settings(repository) -> Secrets -> New secret
, name the secret TRAFFIC_TOKEN
and copy the PAT into the box.