# toc-generator
**Repository Path**: mirrors_hanxiao/toc-generator
## Basic Information
- **Project Name**: toc-generator
- **Description**: GitHub Actions to generate TOC (Table of Contents)
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2026-03-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# TOC Generator
[](https://github.com/technote-space/toc-generator/actions)
[](https://codecov.io/gh/technote-space/toc-generator)
[](https://www.codefactor.io/repository/github/technote-space/toc-generator)
[](https://github.com/technote-space/toc-generator/blob/master/LICENSE)
*Read this in other languages: [English](README.md), [日本語](README.ja.md).*
This is a `GitHub Action` to generate TOC (Table of Contents),
which executes [DocToc](https://github.com/thlorenz/doctoc) and commits if changed.
## Table of Contents
Details
- [Installation](#installation)
- [Screenshot](#screenshot)
- [Options](#options)
- [Action event details](#action-event-details)
- [Target event](#target-event)
- [Conditions](#conditions)
- [Addition](#addition)
- [GITHUB_TOKEN](#github_token)
- [Create PullRequest](#create-pullrequest)
- [Context variables](#context-variables)
- [Context PR variables](#context-pr-variables)
- [Sample repositories using this Action](#sample-repositories-using-this-action)
- [Author](#author)
## Installation
1. Specify location of TOC (option)
e.g. `README.md`
```markdown
```
[detail](https://github.com/thlorenz/doctoc#specifying-location-of-toc)
1. Setup workflow
e.g. `.github/workflows/toc.yml`
```yaml
on: push
name: TOC Generator
jobs:
generateTOC:
name: TOC Generator
runs-on: ubuntu-latest
steps:
- uses: technote-space/toc-generator@v2
```
## Screenshot

## Options
| name | description | default | required | e.g. |
|:---:|:---|:---:|:---:|:---:|
|TARGET_PATHS|Target file path. (Comma separated, [Detail](https://github.com/thlorenz/doctoc#adding-toc-to-individual-files))|`README*.md`|true|`README*.md,CHANGELOG.md`, `.`|
|TOC_TITLE|TOC Title|`**Table of Contents**`| |`''`|
|MAX_HEADER_LEVEL|Maximum heading level. ([Detail](https://github.com/thlorenz/doctoc#specifying-a-maximum-heading-level-for-toc-entries))| | |`3`|
|FOLDING|Whether to make TOC foldable|`false`| |`true`|
|COMMIT_MESSAGE|Commit message|`docs: update TOC`|true|`feat: update TOC`|
|COMMIT_NAME|Git commit name|`${github.actor}`| | |
|COMMIT_EMAIL|Git commit email|`${github.actor}@users.noreply.github.com`| | |
|PR_BRANCH_PREFIX|PullRequest branch prefix|`toc-generator/`|true| |
|PR_BRANCH_NAME|PullRequest branch name
[Context variables](#context-variables)|`update-toc-${PR_ID}`|true|`toc-${PR_NUMBER}`|
|PR_TITLE|PullRequest title
[Context variables](#context-variables)|`docs: update TOC (${PR_MERGE_REF})`|true|`feat: update TOC`|
|PR_BODY|PullRequest body
[Context PR variables](#context-pr-variables)|[action.yml](action.yml)|true| |
|PR_COMMENT_BODY|PullRequest body for comment
[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| | |
|PR_CLOSE_MESSAGE|Message body when closing PullRequest|`This PR has been closed because it is no longer needed.`| | |
|TARGET_BRANCH_PREFIX|Filter by branch name| | |`release/`|
|INCLUDE_LABELS|Labels used to check if the PullRequest has it| | |`Label1, Label2`|
|OPENING_COMMENT|Opening comment (for other than DocToc)|`