Traffic to Badge #78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Traffic to Badge | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| traffic: | |
| name: Collect traffic and generate badges | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get commit message | |
| id: message | |
| uses: actions/github-script@v7 | |
| with: | |
| result-encoding: string | |
| script: | | |
| const time = new Date(Date.now()).toISOString(); | |
| return `Traffic data update at ${time}`; | |
| - name: Collect traffic data | |
| id: traffic | |
| uses: yi-Xu-0100/traffic-to-badge@v1.4.0 | |
| with: | |
| my_token: ${{ secrets.TRAFFIC_TOKEN }} | |
| static_list: 'asgeirtj/system_prompts_leaks' | |
| views_color: '2088FF' | |
| clones_color: '2088FF' | |
| views_week_color: '30A14E' | |
| clones_week_color: '30A14E' | |
| logo: github | |
| - name: Accumulate history and build dashboard | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: python3 .github/scripts/accumulate-traffic.py "${{ steps.traffic.outputs.traffic_path }}" | |
| - name: Deploy to traffic branch | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: traffic | |
| publish_dir: ${{ steps.traffic.outputs.traffic_path }} | |
| user_name: 'github-actions[bot]' | |
| user_email: 'github-actions[bot]@users.noreply.github.com' | |
| full_commit_message: ${{ steps.message.outputs.result }} |