From 679302c25a2036f7e1405fd8d194e6d3e4d0e7a8 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:39:21 +0200 Subject: [PATCH 1/8] feat: add mdx style comments --- main.py | 2 +- syntax.json | 15 +++++++++++---- tests/test_closed.diff | 12 ++++++++++++ tests/test_new.diff | 12 ++++++++++++ tests/test_todo_parser.py | 6 ++++++ 5 files changed, 42 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index b1ec73e..8573d1c 100644 --- a/main.py +++ b/main.py @@ -308,7 +308,7 @@ class TodoParser(object): raise Exception('Cannot retrieve languages data. Operation will abort.') # Load the comment syntax data for identifying comments. - syntax_url = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/syntax.json' + syntax_url = 'https://raw.githubusercontent.com/thomasfkjorna/todo-to-issue-action/master/syntax.json' syntax_request = requests.get(url=syntax_url) if syntax_request.status_code == 200: self.syntax_dict = syntax_request.json() diff --git a/syntax.json b/syntax.json index 374112e..24f27e0 100644 --- a/syntax.json +++ b/syntax.json @@ -365,6 +365,13 @@ "start": "" } + }, + { + "type": "block", + "pattern": { + "start": "{/\\*", + "end": "\\*/}" + } } ] }, @@ -546,7 +553,7 @@ }, { "language": "HCL", - "markers" : [ + "markers": [ { "type": "line", "pattern": "#" @@ -566,7 +573,7 @@ }, { "language": "SCSS", - "markers" : [ + "markers": [ { "type": "line", "pattern": "//" @@ -578,11 +585,11 @@ "end": "\\*/" } } - ] + ] }, { "language": "Twig", - "markers" : [ + "markers": [ { "type": "block", "pattern": { diff --git a/tests/test_closed.diff b/tests/test_closed.diff index d7190f1..9f41f9a 100644 --- a/tests/test_closed.diff +++ b/tests/test_closed.diff @@ -222,3 +222,15 @@ 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,6 +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 +- */} + diff --git a/tests/test_new.diff b/tests/test_new.diff index 690698e..6e747cb 100644 --- a/tests/test_new.diff +++ b/tests/test_new.diff @@ -232,3 +232,15 @@ 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,6 @@ ++ {/* 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 ++ */} diff --git a/tests/test_todo_parser.py b/tests/test_todo_parser.py index 2c1e671..c3c0c09 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -64,6 +64,9 @@ class NewIssueTests(unittest.TestCase): 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, 'md'), 2) + class ClosedIssueTests(unittest.TestCase): # Check for removed TODOs across the files specified. @@ -117,6 +120,9 @@ class ClosedIssueTests(unittest.TestCase): 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, 'md'), 2) + class IgnorePatternTests(unittest.TestCase): From 1ce77430b2d0a9655d2c3a57288de071bdc2515c Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:45:00 +0200 Subject: [PATCH 2/8] fix: set the text language correctly --- action.yml | 58 +++++++++++++++++++-------------------- tests/test_todo_parser.py | 4 +-- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/action.yml b/action.yml index b7c8020..8ad69c1 100644 --- a/action.yml +++ b/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: 'Dockerfile' 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 diff --git a/tests/test_todo_parser.py b/tests/test_todo_parser.py index c3c0c09..17963cf 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -65,7 +65,7 @@ class NewIssueTests(unittest.TestCase): 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, 'md'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 2) class ClosedIssueTests(unittest.TestCase): @@ -121,7 +121,7 @@ class ClosedIssueTests(unittest.TestCase): 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, 'md'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 2) class IgnorePatternTests(unittest.TestCase): From e70ad788c527c18994fc3059d15b3901754479d9 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:47:06 +0200 Subject: [PATCH 3/8] fix: add test for .mdx --- tests/test_closed.diff | 12 +++++++++++- tests/test_new.diff | 12 ++++++++++++ tests/test_todo_parser.py | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/test_closed.diff b/tests/test_closed.diff index 9f41f9a..a742a62 100644 --- a/tests/test_closed.diff +++ b/tests/test_closed.diff @@ -233,4 +233,14 @@ index 525e25d..ba4e68d 100644 - also need to be turned into todos, and hopefully - kept together as one todo - */} - +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,6 +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 +- */} diff --git a/tests/test_new.diff b/tests/test_new.diff index 6e747cb..92ce575 100644 --- a/tests/test_new.diff +++ b/tests/test_new.diff @@ -244,3 +244,15 @@ index 0000000..7cccc5b + also need to be turned into todos, and hopefully + kept together as one todo + */} +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,6 @@ ++ {/* 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 ++ */} diff --git a/tests/test_todo_parser.py b/tests/test_todo_parser.py index 17963cf..c2d2e04 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -65,7 +65,7 @@ class NewIssueTests(unittest.TestCase): 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'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 4) class ClosedIssueTests(unittest.TestCase): @@ -121,7 +121,7 @@ class ClosedIssueTests(unittest.TestCase): 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'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 4) class IgnorePatternTests(unittest.TestCase): From 725d3e2b98aff4b24a3a9b5554860ba46a983714 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:48:57 +0200 Subject: [PATCH 4/8] feat: add checkbox todos --- syntax.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/syntax.json b/syntax.json index 24f27e0..424c735 100644 --- a/syntax.json +++ b/syntax.json @@ -372,6 +372,10 @@ "start": "{/\\*", "end": "\\*/}" } + }, + { + "type": "line", + "pattern": "- [ ]" } ] }, From 1fe2b4ae2a95128caa04e93566bdd8b1313be399 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:57:42 +0200 Subject: [PATCH 5/8] fix: make the checkbox test pass --- syntax.json | 2 +- tests/test_closed.diff | 6 ++++-- tests/test_new.diff | 6 ++++-- tests/test_todo_parser.py | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/syntax.json b/syntax.json index 424c735..5784548 100644 --- a/syntax.json +++ b/syntax.json @@ -375,7 +375,7 @@ }, { "type": "line", - "pattern": "- [ ]" + "pattern": "- \\[ \\]" } ] }, diff --git a/tests/test_closed.diff b/tests/test_closed.diff index a742a62..97726ab 100644 --- a/tests/test_closed.diff +++ b/tests/test_closed.diff @@ -226,21 +226,23 @@ 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,6 +0,0 @@ +@@ -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,6 +0,0 @@ +@@ -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/test_new.diff b/tests/test_new.diff index 92ce575..5aa04b5 100644 --- a/tests/test_new.diff +++ b/tests/test_new.diff @@ -237,22 +237,24 @@ new file mode 100644 index 0000000..7cccc5b --- /dev/null +++ b/src/tests/example_file.md -@@ -0,0 +1,6 @@ +@@ -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,6 @@ +@@ -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/test_todo_parser.py b/tests/test_todo_parser.py index c2d2e04..4fecbf5 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -65,7 +65,7 @@ class NewIssueTests(unittest.TestCase): 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'), 4) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6) class ClosedIssueTests(unittest.TestCase): @@ -121,7 +121,7 @@ class ClosedIssueTests(unittest.TestCase): 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'), 4) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'markdown'), 6) class IgnorePatternTests(unittest.TestCase): From 18a7dc81ad06980cb4a80e215a3c24dd36f3297f Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 17 May 2022 10:59:29 +0200 Subject: [PATCH 6/8] fix: revert for pr --- action.yml | 2 +- main.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 8ad69c1..538470f 100644 --- a/action.yml +++ b/action.yml @@ -3,7 +3,7 @@ description: 'Converts IDE TODO comments to GitHub issues' author: 'Alastair Mooney' runs: using: 'docker' - image: 'Dockerfile' + image: 'docker://ghcr.io/alstr/todo-to-issue-action:v4.7' branding: icon: 'check-square' color: 'orange' diff --git a/main.py b/main.py index 8573d1c..b1ec73e 100644 --- a/main.py +++ b/main.py @@ -308,7 +308,7 @@ class TodoParser(object): raise Exception('Cannot retrieve languages data. Operation will abort.') # Load the comment syntax data for identifying comments. - syntax_url = 'https://raw.githubusercontent.com/thomasfkjorna/todo-to-issue-action/master/syntax.json' + syntax_url = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/syntax.json' syntax_request = requests.get(url=syntax_url) if syntax_request.status_code == 200: self.syntax_dict = syntax_request.json() From 95da0e460685de9958b2506ebe29aadfc85094e4 Mon Sep 17 00:00:00 2001 From: Alastair Mooney Date: Thu, 19 May 2022 12:29:49 +0100 Subject: [PATCH 7/8] Fix image URL --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 538470f..4ee047a 100644 --- a/action.yml +++ b/action.yml @@ -3,7 +3,7 @@ description: 'Converts IDE TODO comments to GitHub issues' author: 'Alastair Mooney' runs: using: 'docker' - image: 'docker://ghcr.io/alstr/todo-to-issue-action:v4.7' + image: 'docker://ghcr.io/alstr/todo-to-issue-action:v4.6' branding: icon: 'check-square' color: 'orange' From 872972dc448595db879dd8e98f8abbf76811e0fd Mon Sep 17 00:00:00 2001 From: Alastair Mooney Date: Thu, 19 May 2022 12:33:27 +0100 Subject: [PATCH 8/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff611cf..4e9ae2f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Create a `workflow.yml` file in your `.github/workflows` directory like: steps: - uses: "actions/checkout@master" - name: "TODO to Issue" - uses: "alstr/todo-to-issue-action@v4.6.3" + uses: "alstr/todo-to-issue-action@v4.6.4" id: "todo" ```