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
- Host: GitHub
- URL: https://github.com/zentered/reading-time-action
- Owner: zentered
- License: mit
- Created: 2021-06-25T09:31:20.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-01-22T21:46:28.000Z (over 4 years ago)
- Last Synced: 2025-04-02T23:05:58.529Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 395 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 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).