https://github.com/harunrst/reading-time-action
Reading time action calculates medium-like reading times of markdown files in your repository and inserts them to the top of your markdown files.
https://github.com/harunrst/reading-time-action
actions github github-actions markdown reading-time
Last synced: 7 months ago
JSON representation
Reading time action calculates medium-like reading times of markdown files in your repository and inserts them to the top of your markdown files.
- Host: GitHub
- URL: https://github.com/harunrst/reading-time-action
- Owner: harunrst
- License: mit
- Created: 2023-02-10T12:57:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-12T10:05:00.000Z (over 2 years ago)
- Last Synced: 2025-06-06T01:23:22.012Z (8 months ago)
- Topics: actions, github, github-actions, markdown, reading-time
- Language: TypeScript
- Homepage:
- Size: 755 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
2 min read
# GitHub Action to Calculate & Insert Reading Time
Reading time action calculates medium-like reading times of markdown files in your repository and prepends them to the top of your markdown files.

You can;
- Pick your calculation strategy: only readme file, specific paths, and all markdown files.
- Pick your style: regular/bold text, align it to left/center/right.
- Merge and run as you wish;
- Run on push / manually: get auto-generated PR to your markdown files or push to your branch.
- Run on pull-request: update your pull request with calculated times.
- Or do whatever you wish to do with the updated markdowns :)
## Usage
All examples below are triggered only when you make a change on a markdown file. To trigger for the first time, I suggest you run manually using `workflow_dispatch`
## Inputs
- **strategy**: `readme`(default), `paths`(requires 'paths' input), `all`
- **paths**: i.e `docs`, `docs|src/marks`
- **text-style**: `default`(default), `bold`
- **text-align**: `left`(default), `center`, `right`
### Example Workflow File
Updates readme and works on push / manually and creates pull-request. On push triggers only if there is a change on readme file.
```yaml
name: Reading Time
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '**.md'
jobs:
calculate-reading-time:
runs-on: ubuntu-latest
name: Calculate Reading Time
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Calculate & Prepend Reading Time
uses: harunrst/reading-time-action@v1.0
with:
strategy: readme
text-style: default
# Example with paths strategy
# - name: Calculate & Prepend Reading Time
# uses: harunrst/reading-time-action@v1.0
# with:
# strategy: paths
# paths: docs|files
# text-style: default
- name: Commit Changes
uses: EndBug/add-and-commit@v9
with:
message: Edited markdown files with reading times.
push: false
# !! Allow GitHub Actions to create pull-request from settings in your repository
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
title: Update markdown files with reading time.
body: Auto-generated Pull Request by [reading-time-action](https://github.com/harunrst/reading-time-action).
branch: reading-time-action
# Example Push Changes
# - name: Push changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
```

### Example Repositories
- [Progressium-API](https://github.com/harunrst/Progressium-Api)
- [Essentials-of-Being-a-Software-Engineer](https://github.com/harunrst/Essentials-of-Being-a-Software-Engineer)