Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

kausko/GitHits

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHits

A GitHub Action for *permanently storing the traffic insights, i.e. views and counts, generated by GitHub.

*GitHub only provides traffic insights over a 14-day period. This GitHub Action was built to overcome that limitation.

Built for usage with GitHitServer.

Usage

  • Create/Retrieve a Personal Access Token with repository-level access and create a repository secret with key: PAT and value: 40-character-PAT
  • Head over to GitHub actions and create a GitHub Actions workflow file by clicking on set up a workflow yourself
  • In the created file (.github/workflows/main.yml), add the following contents:
# Controls when the action will run. 
on:
  schedule:
    - cron: "00 23 * * *"
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  j1:
    name: GitHitJob
    runs-on: ubuntu-latest
    steps:
      - name: GitHits-Action
        id: gh
        uses: kausko/GitHits@v1
        with:
          pat: ${{ secrets.PAT }}
      - name: Output
        run: echo ${{ steps.gh.outputs.status }}
  • This action will run everyday at 23:00 and populate the hits.json file. This behaviour can be changed by modifying the cron value.
  • This action can also be run manually.
  • To use this data on your README, head over to GitHitServer.

NOTE: Keep the IDs, variables and secrets consistent throughout the setup

Inspired by