zentered / reading-time-action

GitHub Action to calculate the reading time of Markdown files and write the results to a manifest.json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unit Test status Unit Test status Semantic Release bagde Semantic Release bagde

Reading Time to Manifest Action

GitHub Action to calculate reading time of Markdown files in the specified folder and add results to a manifest.json

Usage

- uses: zentered/reading-time-action
  with:
    path: docs

Inputs

Name Requirement Default Description
path optional docs Path where the markdown files and manifest are located

Outputs

{
  "text": "1 min",
  "minutes": 0.475,
  "time": 28500,
  "words": 95
}

Complete Workflow with Commit & Push

This action does not commit/push to your repo. You can use the github-push-action. Here's a complete example:

name: Reading Time

 on:
   push:
     branches:
       - '**'
       - '!main'
     paths:
       - 'docs/**'

 jobs:
   reading-time:
     runs-on: ubuntu-latest
     name: calculate reading time
     steps:
       - uses: actions/checkout@v2
       - name: Сalculate reading time
         uses: zentered/reading-time-action@v1.0.0
       - name: Commit Manifest
         run: |
           git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
           git config --local user.name "github-actions[bot]"
           git commit docs/manifest.json -m "chore: calculate reading time"
       - name: Push changes
         uses: ad-m/github-push-action@v0.6.0
         with:
           github_token: ${{ secrets.GITHUB_TOKEN }}
           branch: ${{ github.ref }}

Contributing

See CONTRIBUTING.

License

See LICENSE.

About

GitHub Action to calculate the reading time of Markdown files and write the results to a manifest.json

License:MIT License


Languages

Language:JavaScript 100.0%