An open API service indexing awesome lists of open source software.

https://github.com/zentered/reading-time-action

GitHub Action to calculate the reading time of Markdown files and write the results to a manifest.json
https://github.com/zentered/reading-time-action

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          




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

```yaml
- 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

```json
{
"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](https://github.com/ad-m/github-push-action). Here's a complete example:

```yaml
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](CONTRIBUTING.md).

## License

See [LICENSE](LICENSE).