Skip to content

Commit 8e89036

Browse files
feat: add signoff option (#360)
1 parent 9d0592a commit 8e89036

File tree

6 files changed

+65
-55
lines changed

6 files changed

+65
-55
lines changed

README.ja.md

+28-27
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,34 @@
6262
![behavior](https://raw.githubusercontent.com/technote-space/toc-generator/images/screenshot.gif)
6363
6464
## オプション
65-
| name | description | default | required | e.g. |
66-
|:---|:---|:---|:---|:---|
67-
|TARGET_PATHS|対象のファイルパス (カンマ区切り, [詳細](https://github.com/thlorenz/doctoc#adding-toc-to-individual-files))|`README*.md`|true|`README*.md,CHANGELOG.md`, `.`|
68-
|TOC_TITLE|目次タイトル|`**Table of Contents**`| |`''`|
69-
|MAX_HEADER_LEVEL|Heading最大レベル ([詳細](https://github.com/thlorenz/doctoc#specifying-a-maximum-heading-level-for-toc-entries))| | |`3`|
70-
|CUSTOM_MODE|Customモードかどうか([生成例](samples/README.horizontal.md))|`false`| |`true`|
71-
|CUSTOM_TEMPLATE|Customテンプレート(Customモード)|`<p align="center">${ITEMS}</p>`| | |
72-
|ITEM_TEMPLATE|アイテムテンプレート(Customモード)|`<a href="${LINK}">${TEXT}</a>`| | |
73-
|SEPARATOR|セパレータ(Customモード)|<code>\<span>&#124;\</span></code>| | |
74-
|FOLDING|目次を折りたたみ式にするかどうか|`false`| |`true`|
75-
|COMMIT_MESSAGE|コミットメッセージ|`chore(docs): update TOC`|true|`docs: update TOC`|
76-
|COMMIT_NAME|コミット時に設定する名前|`${github.actor}`| | |
77-
|COMMIT_EMAIL|コミット時に設定するメールアドレス|`${github.actor}@users.noreply.github.com`| | |
78-
|CREATE_PR|プルリクエストを作成するかどうか|`false`| |`true`|
79-
|CHECK_ONLY_DEFAULT_BRANCH|デフォルトのブランチのみをチェックするかどうか|`false`| |`true`|
80-
|PR_BRANCH_PREFIX|プルリクエストのブランチプリフィックス|`toc-generator/`|true| |
81-
|PR_BRANCH_NAME|プルリクエストのブランチ名<br>[Context variables](#context-variables)|`update-toc-${PR_ID}`|true|`toc-${PR_NUMBER}`|
82-
|PR_TITLE|プルリクエストのタイトル<br>[Context variables](#context-variables)|`chore(docs): update TOC (${PR_MERGE_REF})`|true|`docs: update TOC`|
83-
|PR_BODY|プルリクエストの本文<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)|true| |
84-
|PR_COMMENT_BODY|プルリクエストの本文(コメント用)<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| | |
85-
|PR_CLOSE_MESSAGE|プルリクエストを閉じるときのメッセージ|`This PR has been closed because it is no longer needed.`| | |
86-
|TARGET_BRANCH_PREFIX|ブランチ名のフィルタ| | |`release/`|
87-
|INCLUDE_LABELS|プルリクエストに付与されているかチェックするラベル| | |`Label1, Label2`|
88-
|OPENING_COMMENT|開始コメント (DocToc以外のため)|`<!-- toc `| | |
89-
|CLOSING_COMMENT|終了コメント (DocToc以外のため)|`<!-- tocstop `| | |
90-
|SKIP_COMMENT|スキップコメント| | |`<!-- toc skip `|
91-
|GITHUB_TOKEN|アクセストークン|`${{github.token}}`|true|`${{secrets.ACCESS_TOKEN}}`|
65+
| name | description | default | e.g. |
66+
|:---|:---|:---|:---|
67+
|TARGET_PATHS|対象のファイルパス (カンマ区切り, [詳細](https://github.com/thlorenz/doctoc#adding-toc-to-individual-files))|`README*.md`|`README*.md,CHANGELOG.md`, `.`|
68+
|TOC_TITLE|目次タイトル|`**Table of Contents**`|`''`|
69+
|MAX_HEADER_LEVEL|Heading最大レベル ([詳細](https://github.com/thlorenz/doctoc#specifying-a-maximum-heading-level-for-toc-entries))| |`3`|
70+
|CUSTOM_MODE|Customモードかどうか([生成例](samples/README.horizontal.md))|`false`|`true`|
71+
|CUSTOM_TEMPLATE|Customテンプレート(Customモード)|`<p align="center">${ITEMS}</p>`| |
72+
|ITEM_TEMPLATE|アイテムテンプレート(Customモード)|`<a href="${LINK}">${TEXT}</a>`| |
73+
|SEPARATOR|セパレータ(Customモード)|<code>\<span>&#124;\</span></code>| |
74+
|FOLDING|目次を折りたたみ式にするかどうか|`false`|`true`|
75+
|COMMIT_MESSAGE|コミットメッセージ|`chore(docs): update TOC`|`docs: update TOC`|
76+
|COMMIT_NAME|コミット時に設定する名前|`${github.actor}`| |
77+
|COMMIT_EMAIL|コミット時に設定するメールアドレス|`${github.actor}@users.noreply.github.com`| |
78+
|CREATE_PR|プルリクエストを作成するかどうか|`false`|`true`|
79+
|CHECK_ONLY_DEFAULT_BRANCH|デフォルトのブランチのみをチェックするかどうか|`false`|`true`|
80+
|PR_BRANCH_PREFIX|プルリクエストのブランチプリフィックス|`toc-generator/`| |
81+
|PR_BRANCH_NAME|プルリクエストのブランチ名<br>[Context variables](#context-variables)|`update-toc-${PR_ID}`|`toc-${PR_NUMBER}`|
82+
|PR_TITLE|プルリクエストのタイトル<br>[Context variables](#context-variables)|`chore(docs): update TOC (${PR_MERGE_REF})`|`docs: update TOC`|
83+
|PR_BODY|プルリクエストの本文<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| |
84+
|PR_COMMENT_BODY|プルリクエストの本文(コメント用)<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| |
85+
|PR_CLOSE_MESSAGE|プルリクエストを閉じるときのメッセージ|`This PR has been closed because it is no longer needed.`| |
86+
|TARGET_BRANCH_PREFIX|ブランチ名のフィルタ| |`release/`|
87+
|INCLUDE_LABELS|プルリクエストに付与されているかチェックするラベル| |`Label1, Label2`|
88+
|OPENING_COMMENT|開始コメント (DocToc以外のため)|`<!-- toc `| |
89+
|CLOSING_COMMENT|終了コメント (DocToc以外のため)|`<!-- tocstop `| |
90+
|SKIP_COMMENT|スキップコメント| |`<!-- toc skip `|
91+
|GITHUB_TOKEN|アクセストークン|`${{github.token}}`|`${{secrets.ACCESS_TOKEN}}`|
92+
|SIGNOFF| Signed-off-byを付与 | |`true`|
9293

9394
### 個別に指定
9495
[doctoc](https://github.com/technote-space/doctoc#example) に使用されているオプションはコメントで値を指定することが可能です。

README.md

+28-27
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,34 @@ e.g. `README.md`
6363
![behavior](https://raw.githubusercontent.com/technote-space/toc-generator/images/screenshot.gif)
6464
6565
## Options
66-
| name | description | default | required | e.g. |
67-
|:---|:---|:---|:---|:---|
68-
|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`, `.`|
69-
|TOC_TITLE|TOC Title|`**Table of Contents**`| |`''`|
70-
|MAX_HEADER_LEVEL|Maximum heading level. ([Detail](https://github.com/thlorenz/doctoc#specifying-a-maximum-heading-level-for-toc-entries))| | |`3`|
71-
|CUSTOM_MODE|Whether it is custom mode([Generated Example](samples/README.horizontal.md))|`false`| |`true`|
72-
|CUSTOM_TEMPLATE|Custom template for custom mode|`<p align="center">${ITEMS}</p>`| | |
73-
|ITEM_TEMPLATE|Item template for custom mode|`<a href="${LINK}">${TEXT}</a>`| | |
74-
|SEPARATOR|Separator for custom mode|<code>\<span>&#124;\</span></code>| | |
75-
|FOLDING|Whether to make TOC foldable|`false`| |`true`|
76-
|COMMIT_MESSAGE|Commit message|`chore(docs): update TOC`|true|`docs: update TOC`|
77-
|COMMIT_NAME|Git commit name|`${github.actor}`| | |
78-
|COMMIT_EMAIL|Git commit email|`${github.actor}@users.noreply.github.com`| | |
79-
|CREATE_PR|Whether to create PullRequest|`false`| |`true`|
80-
|CHECK_ONLY_DEFAULT_BRANCH|Whether to check only default branch|`false`| |`true`|
81-
|PR_BRANCH_PREFIX|PullRequest branch prefix|`toc-generator/`|true| |
82-
|PR_BRANCH_NAME|PullRequest branch name<br>[Context variables](#context-variables)|`update-toc-${PR_ID}`|true|`toc-${PR_NUMBER}`|
83-
|PR_TITLE|PullRequest title<br>[Context variables](#context-variables)|`chore(docs): update TOC (${PR_MERGE_REF})`|true|`docs: update TOC`|
84-
|PR_BODY|PullRequest body<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)|true| |
85-
|PR_COMMENT_BODY|PullRequest body for comment<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| | |
86-
|PR_CLOSE_MESSAGE|Message body when closing PullRequest|`This PR has been closed because it is no longer needed.`| | |
87-
|TARGET_BRANCH_PREFIX|Filter by branch name| | |`release/`|
88-
|INCLUDE_LABELS|Labels used to check if the PullRequest has it| | |`Label1, Label2`|
89-
|OPENING_COMMENT|Opening comment (for other than DocToc)|`<!-- toc `| | |
90-
|CLOSING_COMMENT|Closing comment (for other than DocToc)|`<!-- tocstop `| | |
91-
|SKIP_COMMENT|Skip comment| | |`<!-- toc skip `|
92-
|GITHUB_TOKEN|Access token|`${{github.token}}`|true|`${{secrets.ACCESS_TOKEN}}`|
66+
| name | description | default | e.g. |
67+
|:---|:---|:---|:---|
68+
|TARGET_PATHS|Target file path. (Comma separated, [Detail](https://github.com/thlorenz/doctoc#adding-toc-to-individual-files))|`README*.md`|`README*.md,CHANGELOG.md`, `.`|
69+
|TOC_TITLE|TOC Title|`**Table of Contents**`|`''`|
70+
|MAX_HEADER_LEVEL|Maximum heading level. ([Detail](https://github.com/thlorenz/doctoc#specifying-a-maximum-heading-level-for-toc-entries))| |`3`|
71+
|CUSTOM_MODE|Whether it is custom mode([Generated Example](samples/README.horizontal.md))|`false`|`true`|
72+
|CUSTOM_TEMPLATE|Custom template for custom mode|`<p align="center">${ITEMS}</p>`| |
73+
|ITEM_TEMPLATE|Item template for custom mode|`<a href="${LINK}">${TEXT}</a>`| |
74+
|SEPARATOR|Separator for custom mode|<code>\<span>&#124;\</span></code>| |
75+
|FOLDING|Whether to make TOC foldable|`false`|`true`|
76+
|COMMIT_MESSAGE|Commit message|`chore(docs): update TOC`|`docs: update TOC`|
77+
|COMMIT_NAME|Git commit name|`${github.actor}`| |
78+
|COMMIT_EMAIL|Git commit email|`${github.actor}@users.noreply.github.com`| |
79+
|CREATE_PR|Whether to create PullRequest|`false`|`true`|
80+
|CHECK_ONLY_DEFAULT_BRANCH|Whether to check only default branch|`false`|`true`|
81+
|PR_BRANCH_PREFIX|PullRequest branch prefix|`toc-generator/`| |
82+
|PR_BRANCH_NAME|PullRequest branch name<br>[Context variables](#context-variables)|`update-toc-${PR_ID}`|`toc-${PR_NUMBER}`|
83+
|PR_TITLE|PullRequest title<br>[Context variables](#context-variables)|`chore(docs): update TOC (${PR_MERGE_REF})`|`docs: update TOC`|
84+
|PR_BODY|PullRequest body<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| |
85+
|PR_COMMENT_BODY|PullRequest body for comment<br>[Context PR variables](#context-pr-variables)|[action.yml](action.yml)| |
86+
|PR_CLOSE_MESSAGE|Message body when closing PullRequest|`This PR has been closed because it is no longer needed.`| |
87+
|TARGET_BRANCH_PREFIX|Filter by branch name| |`release/`|
88+
|INCLUDE_LABELS|Labels used to check if the PullRequest has it| |`Label1, Label2`|
89+
|OPENING_COMMENT|Opening comment (for other than DocToc)|`<!-- toc `| |
90+
|CLOSING_COMMENT|Closing comment (for other than DocToc)|`<!-- tocstop `| |
91+
|SKIP_COMMENT|Skip comment| |`<!-- toc skip `|
92+
|GITHUB_TOKEN|Access token|`${{github.token}}`|`${{secrets.ACCESS_TOKEN}}`|
93+
|SIGNOFF| Add `Signed-off-by` line | |`true`|
9394

9495
### Specify options individually
9596
The options used for [doctoc](https://github.com/technote-space/doctoc#example) can be commented to specify values.

action.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ inputs:
1212
API_TOKEN:
1313
description: Secret GitHub API token used to make API requests.
1414
required: false
15+
SIGNOFF:
16+
description: 'Add `Signed-off-by` line by the committer at the end of the commit log message.'
17+
required: false
1518

1619
TARGET_PATHS:
1720
description: Target file path. (Comma separated, @see https://github.com/thlorenz/doctoc#adding-toc-to-individual-files)

src/utils/misc.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ describe('getRunnerArguments', () => {
110110
prTitleForDefaultBranch: '',
111111
targetBranchPrefix: '',
112112
targetEvents: TARGET_EVENTS,
113+
signoff: false,
113114
});
114115
});
115116

@@ -135,6 +136,7 @@ describe('getRunnerArguments', () => {
135136
process.env.INPUT_TARGET_PATHS = '/';
136137
process.env.INPUT_CREATE_PR = 'false';
137138
process.env.INPUT_CHECK_ONLY_DEFAULT_BRANCH = 'true';
139+
process.env.INPUT_SIGNOFF = 'true';
138140

139141
const args = getRunnerArguments();
140142
delete args.logger;
@@ -171,6 +173,7 @@ describe('getRunnerArguments', () => {
171173
prTitleForDefaultBranch: 'test-default-branch: create pull request (${PR_NUMBER})',
172174
targetBranchPrefix: 'feature/',
173175
targetEvents: TARGET_EVENTS,
176+
signoff: true,
174177
});
175178
});
176179
});

src/utils/misc.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const getRunnerArguments = (): MainArguments => {
6464
targetEvents: TARGET_EVENTS,
6565
notCreatePr: !Utils.getBoolValue(getInput('CREATE_PR')),
6666
checkOnlyDefaultBranch: Utils.getBoolValue(getInput('CHECK_ONLY_DEFAULT_BRANCH')),
67+
signoff: Utils.getBoolValue(getInput('SIGNOFF')),
6768
};
6869
};
6970

src/utils/process.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ describe('main', () => {
307307
process.env.INPUT_MAX_HEADER_LEVEL = '1';
308308
process.env.INPUT_ENTRY_PREFIX = '☆';
309309
process.env.INPUT_CREATE_PR = 'true';
310+
process.env.INPUT_SIGNOFF = 'true';
310311
const mockStdout = spyOnStdout();
311312
const mockOutput = spyOnSetOutput();
312313
setChildProcessParams({
@@ -380,7 +381,7 @@ describe('main', () => {
380381
'[command]git config \'user.email\' \'[email protected]\'',
381382
'::endgroup::',
382383
'::group::Committing...',
383-
'[command]git commit -qm \'chore(docs): update TOC\'',
384+
'[command]git commit --signoff -qm \'chore(docs): update TOC\'',
384385
'[command]git show \'--stat-count=10\' HEAD',
385386
'::endgroup::',
386387
'::group::Checking references diff...',

0 commit comments

Comments
 (0)