Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MDX comments and GFM checkbox TODOs #116

Merged
merged 6 commits into from May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 29 additions & 29 deletions action.yml
@@ -1,71 +1,71 @@
name: "TODO to Issue"
description: "Converts IDE TODO comments to GitHub issues"
author: "Alastair Mooney"
name: 'TODO to Issue'
description: 'Converts IDE TODO comments to GitHub issues'
author: 'Alastair Mooney'
runs:
using: "docker"
image: "docker://ghcr.io/alstr/todo-to-issue-action:v4.6"
using: 'docker'
image: 'docker://ghcr.io/alstr/todo-to-issue-action:v4.7'
branding:
icon: "check-square"
color: "orange"
icon: 'check-square'
color: 'orange'
inputs:
REPO:
description: "The path to the repository where the action will be used, e.g. 'alstr/my-repo' (automatically set)"
required: true
default: "${{ github.repository }}"
default: '${{ github.repository }}'
BEFORE:
description: "The SHA of the last pushed commit (automatically set)"
description: 'The SHA of the last pushed commit (automatically set)'
required: true
default: "${{ github.event.before || github.base_ref }}"
default: '${{ github.event.before || github.base_ref }}'
COMMITS:
description: "An array of commit objects describing the pushed commits"
description: 'An array of commit objects describing the pushed commits'
required: true
default: "${{ toJSON(github.event.commits) }}"
default: '${{ toJSON(github.event.commits) }}'
DIFF_URL:
description: "The URL to use to get the diff (automatically set)"
description: 'The URL to use to get the diff (automatically set)'
required: true
default: "${{ github.event.pull_request.diff_url }}"
default: '${{ github.event.pull_request.diff_url }}'
SHA:
description: "The SHA of the latest commit (automatically set)"
description: 'The SHA of the latest commit (automatically set)'
required: true
default: "${{ github.sha }}"
default: '${{ github.sha }}'
TOKEN:
description: "The GitHub access token to allow us to retrieve, create and update issues (automatically set)"
description: 'The GitHub access token to allow us to retrieve, create and update issues (automatically set)'
required: false
default: ${{ github.token }}
LABEL:
description: "The label that will be used to identify TODO comments (deprecated)"
description: 'The label that will be used to identify TODO comments (deprecated)'
required: false
COMMENT_MARKER:
description: "The marker used to signify a line comment in your code (deprecated)"
description: 'The marker used to signify a line comment in your code (deprecated)'
required: false
CLOSE_ISSUES:
description: "Optional input that specifies whether to attempt to close an issue when a TODO is removed"
description: 'Optional input that specifies whether to attempt to close an issue when a TODO is removed'
required: true
default: true
AUTO_P:
description: "For multiline TODOs, format each line as a new paragraph when creating the issue"
description: 'For multiline TODOs, format each line as a new paragraph when creating the issue'
required: true
default: true
PROJECTS_SECRET:
description: "Encrypted secret corresponding to your personal access token (do not enter the actual secret)"
description: 'Encrypted secret corresponding to your personal access token (do not enter the actual secret)'
required: false
USER_PROJECTS:
description: "Default user projects"
description: 'Default user projects'
required: false
ORG_PROJECTS:
description: "Default organisation projects"
description: 'Default organisation projects'
required: false
IGNORE:
description: "A collection of comma-delimited regular expression that matches files that should be ignored when searching for TODOs"
description: 'A collection of comma-delimited regular expression that matches files that should be ignored when searching for TODOs'
required: false
AUTO_ASSIGN:
description: "Automatically assign new issues to the user who triggered the action"
description: 'Automatically assign new issues to the user who triggered the action'
required: true
default: false
ACTOR:
description: "The username of the person who triggered the action"
description: 'The username of the person who triggered the action'
required: true
default: "${{ github.actor }}"
default: '${{ github.actor }}'
ISSUE_TEMPLATE:
description: "The template used to format new issues"
description: 'The template used to format new issues'
required: false
19 changes: 15 additions & 4 deletions syntax.json
Expand Up @@ -365,6 +365,17 @@
"start": "<!--",
"end": "-->"
}
},
{
"type": "block",
"pattern": {
"start": "{/\\*",
"end": "\\*/}"
}
},
{
"type": "line",
"pattern": "- \\[ \\]"
}
]
},
Expand Down Expand Up @@ -546,7 +557,7 @@
},
{
"language": "HCL",
"markers" : [
"markers": [
{
"type": "line",
"pattern": "#"
Expand All @@ -566,7 +577,7 @@
},
{
"language": "SCSS",
"markers" : [
"markers": [
{
"type": "line",
"pattern": "//"
Expand All @@ -578,11 +589,11 @@
"end": "\\*/"
}
}
]
]
},
{
"language": "Twig",
"markers" : [
"markers": [
{
"type": "block",
"pattern": {
Expand Down
24 changes: 24 additions & 0 deletions tests/test_closed.diff
Expand Up @@ -222,3 +222,27 @@ index 525e25d..ba4e68d 100644
- also need to be turned into todos, and hopefully
- kept together as one todo
- #}
diff --git a/tests/example_file.md b/src/tests/example_file.md
index 525e25d..ba4e68d 100644
--- a/src/tests/example_file.md
+++ b/src/tests/example_file.md
@@ -1,7 +0,0 @@
- {/* TODO: Hopefully this comment turns into a todo issue */}
- {/*
- TODO:Multiline comments
- also need to be turned into todos, and hopefully
- kept together as one todo
- */}
- - [ ] TODO: An inline todo that's NOT a comment (what)
diff --git a/tests/example_file.mdx b/src/tests/example_file.mdx
index 525e25d..ba4e68d 100644
--- a/src/tests/example_file.mdx
+++ b/src/tests/example_file.mdx
@@ -1,7 +0,0 @@
- {/* TODO: Hopefully this comment turns into a todo issue */}
- {/*
- TODO:Multiline comments
- also need to be turned into todos, and hopefully
- kept together as one todo
- */}
- - [ ] TODO: An inline todo that's NOT a comment (what)
26 changes: 26 additions & 0 deletions tests/test_new.diff
Expand Up @@ -232,3 +232,29 @@ index 0000000..7cccc5b
+ also need to be turned into todos, and hopefully
+ kept together as one todo
+ #}
diff --git a/tests/example_file.md b/src/tests/example_file.md
new file mode 100644
index 0000000..7cccc5b
--- /dev/null
+++ b/src/tests/example_file.md
@@ -0,0 +1,7 @@
+ {/* TODO: Hopefully this comment turns into a todo issue */}
+ {/*
+ TODO:Multiline comments
+ also need to be turned into todos, and hopefully
+ kept together as one todo
+ */}
+ - [ ] TODO: An inline todo that's NOT a comment (what)
diff --git a/tests/example_file.mdx b/src/tests/example_file.mdx
new file mode 100644
index 0000000..7cccc5b
--- /dev/null
+++ b/src/tests/example_file.mdx
@@ -0,0 +1,7 @@
+ {/* TODO: Hopefully this comment turns into a todo issue */}
+ {/*
+ TODO:Multiline comments
+ also need to be turned into todos, and hopefully
+ kept together as one todo
+ */}
+ - [ ] TODO: An inline todo that's NOT a comment (what)
6 changes: 6 additions & 0 deletions tests/test_todo_parser.py
Expand Up @@ -64,6 +64,9 @@ def test_scss_issues(self):
def test_twig_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'twig'), 2)

def test_md_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6)


class ClosedIssueTests(unittest.TestCase):
# Check for removed TODOs across the files specified.
Expand Down Expand Up @@ -117,6 +120,9 @@ def test_scss_issues(self):
def test_twig_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'twig'), 2)

def test_md_issues(self):
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6)


class IgnorePatternTests(unittest.TestCase):

Expand Down