Skip to content

Commit 1c9c075

Browse files
committed
Track TODOs and FIXMEs separately
1 parent f96d775 commit 1c9c075

File tree

3 files changed

+66
-24
lines changed

3 files changed

+66
-24
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
#
3+
# @license Apache-2.0
4+
#
5+
# Copyright (c) 2023 The Stdlib Authors.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# Initialize variable to hold the annotations:
20+
fixmes=""
21+
22+
# Search for FIXME annotations in the codebase:
23+
for file in $(find . -type f); do
24+
fixme=$(grep -i -n "FIXME:" $file) || true
25+
if [ -n "$fixme" ]; then
26+
lineNumber=$(echo $fixme | cut -d ":" -f 1)
27+
lineContent=$(echo $fixme | cut -d ":" -f 2-)
28+
fixmes="$fixmes
29+
- [ ] [$file](https://github.com/stdlib-js/stdlib/blob/develop/$file#L$lineNumber): $lineContent"
30+
fi
31+
done
32+
33+
# Create a Markdown-formatted comment body:
34+
comment="<!-- This comment is automatically generated by a GitHub Action. -->
35+
36+
# FIXMEs
37+
38+
$fixmes
39+
"
40+
41+
echo "$comment"

.github/workflows/scripts/track_todos

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,11 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19-
# Initialize variables to hold the annotations:
20-
fixmes=""
19+
# Initialize variable to hold the annotations:
2120
todos=""
2221

23-
# Search for FIXME and TODO annotations in all files in the current directory:
22+
# Search for TODO annotations in the codebase:
2423
for file in $(find . -type f); do
25-
fixme=$(grep -i -n "FIXME:" $file) || true
26-
if [ -n "$fixme" ]; then
27-
lineNumber=$(echo $fixme | cut -d ":" -f 1)
28-
lineContent=$(echo $fixme | cut -d ":" -f 2-)
29-
fixmes="$fixmes
30-
- [ ] [$file](https://github.com/stdlib-js/stdlib/blob/develop/$file#L$lineNumber): $lineContent"
31-
fi
3224
todo=$(grep -i -n "TODO:" $file) || true
3325
if [ -n "$todo" ]; then
3426
lineNumber=$(echo $todo | cut -d ":" -f 1)
@@ -41,13 +33,7 @@ done
4133
# Create a Markdown-formatted comment body:
4234
comment="<!-- This comment is automatically generated by a GitHub Action. -->
4335
44-
# TODOs and FIXMEs
45-
46-
## FIXMEs
47-
48-
$fixmes
49-
50-
## TODOs
36+
# TODOs
5137
5238
$todos"
5339

.github/workflows/track_todos.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,32 @@ jobs:
5151
lfs: false
5252
timeout-minutes: 10
5353

54-
# Create content of tracking issue for TODO and FIXME comments:
55-
- name: 'Create content of tracking issue for TODO and FIXME comments'
54+
# Create content of tracking issue for TODO comments:
55+
- name: 'Create content of tracking issue for TODO comments'
5656
run: |
57-
. "$GITHUB_WORKSPACE/.github/workflows/scripts/track_todos" > tracking_issue.md
57+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/track_todos" > tracking_issue_todos.md
5858
59-
# Create an issue from the output file:
60-
- name: 'Create an issue from the output file'
59+
# Create content of tracking issue for FIXME comments:
60+
- name: 'Create content of tracking issue for FIXME comments'
61+
run: |
62+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/track_fixmes" > tracking_issue_fixmes.md
63+
64+
# Create issue for TODO comments:
65+
- name: 'Create issue for TODO comments'
66+
uses: peter-evans/create-issue-from-file@v4
67+
with:
68+
title: 'TODO comments'
69+
content-filepath: ./tracking_issue_todos.md
70+
labels: |
71+
report
72+
automated-issue
73+
74+
# Create issue for FIXME comments:
75+
- name: 'Create issue for FIXME comments'
6176
uses: peter-evans/create-issue-from-file@v4
6277
with:
63-
title: 'TODO and FIXME comments'
64-
content-filepath: ./tracking_issue.md
78+
title: 'FIXME comments'
79+
content-filepath: ./tracking_issue_fixmes.md
6580
labels: |
6681
report
6782
automated-issue

0 commit comments

Comments
 (0)