GitHub action to generate Hits-of-Code badge with hoc calculated metric.
hoc - is a command line tool to calculate Hits-of-Code metric in a source code repository.
You can read more about Hits-of-Code metric in this blog post: Hits-of-Code Instead of SLoC.
To install action copy the workflow code into a .github/workflows/main.yml file in your repository
on: [push]
jobs:
lines_counter_job:
runs-on: ubuntu-latest
name: A job to count hits of code
steps:
- uses: actions/checkout@v4
- id: badge-generator
uses: ./ # write the action name instead
with:
before: 2024-03-03' # default value - now day
dir: . # default value - include all files
exclude: vendor/** # no default value
since: 2000-01-01 # default value - '2000-01-01'
output_dir: ./output # default value - 'output'
filename: hoc-badge.svg # default value - 'hoc-badge.svg'
The badge will be generated into the file ./output/hoc-badge.svg by default.
Use whatever tool you prefer to upload it somewhere.