Issue Recorder lets you save all comments on an issue to a file in your repository or within another issue. Markdown is fully supported.
It is assumed to work by triggering the issue closed event. For instance, when you close an issue, it starts to work and saves all the comments, including their body, on the issue you close to a specific file or another issue you configure.
Issue | → | Markdown File |
---|---|---|
→ |
# .github/workflows/issue-recorder.yml
name: Issue Recorder
on:
issues:
types:
- closed
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Issue Recorder
uses: noraworld/issue-recorder@v0.3.1
with:
mode: file
filepath: .issues/${{ github.event.issue.title }}.md
committer_name: GitHub Actions
committer_email: actions@github.com
extra_text_when_modified: "# From issues"
with_date: true
timezone: Etc/GMT
time_format: h:mm a · MMM d, yyyy (ZZZZ)
with_header: "---\r\ntitle: <TITLE>\r\nassignees: <ASSIGNEES>\r\nlabels: <LABELS>\r\n---"
personal_access_token: GH_TOKEN
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Here are the options you can customize. All options are not necessarily required except for certain conditions, such as when target_issue_number
sometimes has to be specified.
Key | Description | Mode | Type | Default | Examples |
---|---|---|---|---|---|
mode |
Specify where to save the issue, a file , or within another issue 1 |
String | file |
file , issue , "file, issue" |
|
filepath |
Specify the filename to be created or modified | file |
String | issues/<00-INF>/<00-99>/<ISSUE_NUMBER>_<ISSUE_TITLE>.md |
_posts/${{ env.YEAR }}/${{ env.MONTH }}/${{ github.event.issue.title }}-.md |
committer_name |
This value will be used for git commit | file |
String | GitHub Actions |
GitHub Actions |
committer_email |
This value will be used for git commit | file |
String | actions@github.com |
actions@github.com |
overwrite_when_modified |
When the file already exists, the content will be replaced with a new one | file |
Boolean | "" |
true |
extra_text_when_modified |
When the file already exists, this string will be added before the content | file |
String | "# From issues" |
"# From issues" |
notification_comment |
Leave the specified comment here after a file is created or modified (details) | file |
String | "" |
The content of this task was saved in [<FILE_PATH>](<FILE_URL>) |
target_file_repo |
Select a repository with a username whose file you want to commit 2 | file |
String | <REPO_NAME> (the repository where this Action is installed) |
octocat/hello-world |
title_prefix_for_file |
Specify additional letters or emojis appearing at the beginning of the title in a file | file |
String | "" |
🥳 |
target_issue_repo |
Select a repository with a username whose issue you want to transfer | issue |
String | <REPO_NAME> (the repository where this Action is installed) |
octocat/hello-world |
target_issue_number |
Select an issue number 3 | issue |
String | latest |
307 |
fold_threshold |
When the total number of letters in the body and the comments is greater than the specified number here, they are folded 4 | issue |
Integer | infinity |
1000 |
fold_summary |
When the issue is folded, the specified string here will be shown as a summary (details) | issue |
String | "" |
Show details |
title_prefix [DEPRECATED] |
Use title_prefix_for_issue instead |
issue |
String | "" |
✅ |
title_prefix_for_issue |
Specify additional letters or emojis appearing at the beginning of the title in an issue | issue |
String | "" |
✅ |
with_date |
Whether to include the date and time | file , issue |
Boolean | "" |
true |
timezone |
Your timezone | file , issue |
String | Etc/GMT |
Asia/Tokyo |
time_format |
Time format (sample) | file , issue |
String | MMM d, yyyy, h:mm a ZZZZ |
h:mm a · MMM d, yyyy (ZZZZ) |
with_header |
Prepend a header content at the beginning of a file (details) | file , issue |
String | "" |
"---\r\npublished: true\r\n---" |
with_title |
Whether to include the issue title | file , issue |
Boolean | "" |
true |
custom_title |
Use a custom title given here instead of the original issue title | file , issue |
String | "" |
${{ env.TITLE }} |
with_quote |
Specify the mode name and whether to encompass the whole content with a quote for those modes | file , issue |
String | "" |
file , issue , "file, issue" |
skip_body |
Specify the mode name and whether to skip the body of an issue | file , issue |
String | "" |
file , issue , "file, issue" |
personal_access_token |
Specify your personal access token name (key) stored in your repository 2 | file , issue |
String | "" |
GH_TOKEN |
It doesn't take any effect if you specify an option that is not relevant to the mode you select. For example, if you set a mode to file
and specify target_issue_repo
, the option is merely ignored.
Here are some examples of the time formats. You can customize the time format other than the examples below.
Style | Format | Example |
---|---|---|
GitHub comments | MMM d, yyyy, h:mm a ZZZZ |
Jun 30, 2023, 6:55 PM GMT+9 |
X (Twitter) posts | h:mm a · MMM d, yyyy |
6:55 PM · Jun 30, 2023 |
You can use the following special identifiers for notification_comment
.
Identifier | Replaced with | Example |
---|---|---|
<FILE_PATH> |
A file path configured in filepath |
issues/00/42/4201_purchase-boiled-eggs.md |
<FILE_URL> |
A full URL for a file | https://github.com/noraworld/issue-recorder/blob/main/issues/00/42/4201_purchase-boiled-eggs.md |
<FILE_URL_WITH_SHA> |
A full URL for a file with SHA | https://github.com/noraworld/issue-recorder/blob/5c26bf402176693178f8497324fc9b862bdd4a3b/issues/00/42/4201_purchase-boiled-eggs.md |
<REF_NAME> |
A branch name pointing to a commit | main |
For instance, if you specify The content of this task was saved in [<FILE_PATH>](<FILE_URL>)
, the actual comment is like this:
The content of this task was saved in [issues/00/42/4201_purchase-boiled-eggs.md](https://github.com/noraworld/issue-recorder/blob/main/issues/00/42/4201_purchase-boiled-eggs.md)
You can use the following special identifiers for with_header
.
Identifier | Replaced with | Type | Example |
---|---|---|---|
<NUMBER> |
An issue number | Integer |
4201 |
<TITLE> |
An issue title | "String" |
"Purchase Boiled Eggs" |
<ASSIGNEES> |
A list of assignees appointed to an issue | Array[<"String", "String", "String", ...>] |
["noraworld"] |
<LABELS> |
A list of labels attached to an issue | Array[<"String", "String", "String", ...>] |
["purchase"] |
<CREATED_AT> |
Date and time when an issue is created | String |
8:02 AM · Mar 29, 2024 (GMT+9) |
All codes of this project are available under the MIT license. See the LICENSE for more information.
Footnotes
-
If you want to save to both of them, you can use a comma-separated value like
file, issue
. ↩ -
If you don't specify
personal_access_token
,GITHUB_TOKEN
will be used. It is useful, but it has lower permissions, so you need your personal access token with stronger permissions sometimes, like when you want to save a file to another repository by using thetarget_file_repo
option. For details on how to retrieve and store your personal access token, see here. If you want to know each permission for theGITHUB_TOKEN
secret, this article might help you. Don't forget to set the environment variable under theenv
key in your YAML file. The Workflow sample section might help you. ↩ ↩2 -
If you specify the special identifier
latest
, the latest open issue on the specified repository will be obtained. If there is no open issue in the target repository, the action fails. ↩ -
If you specify the empty string
""
, the special identifierinfinity
, or don't specify anything, this option will be disabled. ↩