technote-space / toc-generator Goto Github PK
View Code? Open in Web Editor NEWGitHub Actions to generate TOC (Table of Contents)
License: MIT License
GitHub Actions to generate TOC (Table of Contents)
License: MIT License
DELETE_PACKAGE
#
や +
などにも対応
action によるコミットでは次のアクションは発生しないため、PR後にCIが回らずcheckが通らない場合がある
access token で回避可能
default: ${{ github.token }}
pull_request closed
→ pull number
→ ref
→ pullList
変更を直接commitするのではなくプルリクを作成する機能を追加
I (and I believe many others) have long used a GitHub probot for automatic ToC generation:
https://github.com/pholleran/toc-me
For ease of compatibility, would it be acceptable to use compatible toc marker comments?
<!-- toc -->
and <!-- tocstop -->
?
npx を使用したり global インストールしてから使用してきたが、packageを追加してリリース時にバンドルされるようにしてインストールを省略する
Currently facing an issue running this action, where it prints this error:
command [npx doctoc /home/runner/work/codeql-learninglab-actions/codeql-learninglab-actions/README*.md --title '**Table of Contents**' --github] exited with code 1. message: Command failed: npx doctoc /home/runner/work/codeql-learninglab-actions/codeql-learninglab-actions/README*.md --title '**Table of Contents**' --github
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'which'
Require stack:
- /usr/local/lib/node_modules/npm/node_modules/libnpx/index.js
- /usr/local/lib/node_modules/npm/bin/npx-cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/libnpx/index.js:10:25)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Module.require (internal/modules/cjs/loader.js:848:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
See: https://github.com/github/codeql-learninglab-actions/runs/411835295?check_suite_focus=true
Looks like it's probably a dependency issue in doctoc
, maybe some dependency relying on an implicit dependency?
Steps to reproduce the behavior:
Action runs without module resolution error.
Workflow with this config:
jobs:
generateTOC:
runs-on: ubuntu-latest
name: Generate Table of Contents
steps:
- name: TOC Generator
uses: technote-space/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Seems to also happen when bumping to v2.0.9
checkout が必要な現在の方法から修正
md 以外も一応指定できるようにしておく
e.g.
WRAP = details
TITLE = <summary>Table of Contents</summary>
↓
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
<details>
<summary>Table of Contents</summary>
- [TOC Test1](#toc-test1)
- [TOC Test2](#toc-test2)
- [Test2-1](#test2-1)
- [Test2-2](#test2-2)
</details>
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
--no-tags
指定
warn でエラーを表示して終了させる
When you add emojis to your headers, TOC doesn't work - it generates correctly, but it's links don't always work:
What always work, is links on the Github itself (when you click on left of header) - some of them also generate with or without emoji encoded in the url - and work/don't work if you remove it
Steps to reproduce the behavior:
Should direct you to this header section
now:
push event => push
pull request event => create pull request
change:
CREATE_PR: false
=> push (default)
CREATE_PR: true
=> create pull request
package dependencies 更新用のやつのメッセージのままになっている
TARGET_LABELS
First, thank you for providing this awesome action, we have been using it since early this year! Thanks ❤️ 🙇
Recently, we found the TOC generator seems not to work properly anymore. In particular, on this CHANGELOG.md, it stops working after 0.7.4. I suspect if the document is too long to process?
Github workflow
Here is the dump log from Github action
with:
MAX_HEADER_LEVEL: 2
FOLDING: false
GITHUB_TOKEN: ***
COMMIT_NAME: Jina Dev Bot
COMMIT_EMAIL: [email protected]
TARGET_PATHS: README*.md,CHANGELOG.md,CONTRIBUTING.md
COMMIT_MESSAGE: chore(docs): update TOC
OPENING_COMMENT: <!-- toc
CLOSING_COMMENT: <!-- tocstop
CREATE_PR: true
PR_BRANCH_PREFIX: toc-generator/
PR_BRANCH_NAME: update-toc-${PR_ID}
PR_TITLE: docs: update TOC (${PR_MERGE_REF})
PR_BODY: ## Base PullRequest
${PR_TITLE} (${PR_NUMBER_REF})
## Command results
<details>
<summary>Details: </summary>
${COMMANDS_OUTPUT}
</details>
## Changed files
<details>
<summary>${FILES_SUMMARY}: </summary>
${FILES}
</details>
<hr>
[:octocat: Repo](${ACTION_URL}) | [:memo: Issues](${ACTION_URL}/issues) | [:department_store: Marketplace](${ACTION_MARKETPLACE_URL})
PR_COMMENT_BODY: ## Command results
<details>
<summary>Details: </summary>
${COMMANDS_OUTPUT}
</details>
## Changed files
<details>
<summary>${FILES_SUMMARY}: </summary>
${FILES}
</details>
<hr>
[:octocat: Repo](${ACTION_URL}) | [:memo: Issues](${ACTION_URL}/issues) | [:department_store: Marketplace](${ACTION_MARKETPLACE_URL})
PR_CLOSE_MESSAGE: This PR has been closed because it is no longer needed.
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.9/x64
==================================================
Version: technote-space/[email protected]
b1dc535f5ffbd5cd62324411eb2a1874074337e5
Event: schedule
Action: undefined
sha: af9777d515ed03b8f1b6cff80545685976f8102b
ref: refs/heads/master
owner: jina-ai
repo: jina
Dump context
Context {
payload: { schedule: '0 23 * * *' },
eventName: 'schedule',
sha: 'af9777d515ed03b8f1b6cff80545685976f8102b',
ref: 'refs/heads/master',
workflow: 'Autocommit',
action: 'technote-spacetoc-generator',
actor: 'hanxiao',
job: 'autocommit',
runNumber: 25,
runId: 375316966
}
Dump Payload
{ schedule: '0 23 * * *' }
==================================================
Mirrored: jina-ai/jina#1321
前より高速化したので。
8, 10, 11, 12
TARGET_BRANCHES
git コマンドで clone している + access token を使用していないため private なものは取得不可
access token の設定は面倒なので使用しない
actions/checkout などで取得済みの場合はそれを使用するように対応
無ければ今まで通りgitコマンドで取得
× composer test
〇 yarn test
TOC generator now gives vertical TOC only, would be nice to have a horizontal one
Add an option HORIZONTAL_TOC
or FLATTEN_TOC
as boolean value
Remark: horizontal toc only makes sense when MAX_HEADER_LEVEL = 1
先に目次位置を指定
Normal commits to our repo do not trigger TOC generation any more:
Run technote-space/toc-generator@v1
==================================================
Version: v1.3.1
Event: push
Action: undefined
sha:
ref:
owner: prisma
repo: specs
actor: janpio
==================================================
> This is not target event.
https://github.com/prisma/specs/pull/191/checks?check_run_id=241834689
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.