Skip to content

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

License

Notifications You must be signed in to change notification settings

zentered/reading-time-action

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

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/[email protected]
       - 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/[email protected]
         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

Resources

License

Stars

Watchers

Forks