Skip to content

Commit 5f32d2b

Browse files
committed
refactor: rename MAPPING_FILE to ISSUES_MAPPING_FILE
Relate to #1610
1 parent af07a03 commit 5f32d2b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: src/main/scripts/ci/connect-todos-to-issues.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ https://github.com/${GITHUB_REPOSITORY}/blob/${GITHUB_SHA}/${PUZZLE_FILE}#L${PUZ
6767
Tech debt for: $GITHUB_SHA (#$ORIG_ISSUE)"'
6868

6969
DIR="$(dirname "$1")"
70-
MAPPING_FILE="$DIR/todos-on-github.tsv"
70+
ISSUES_MAPPING_FILE="$DIR/todos-on-github.tsv"
7171

72-
if [ ! -f "$MAPPING_FILE" ]; then
73-
info "$MAPPING_FILE doesn't exist. Creating..."
74-
printf 'Id\tIssue\tState\tCreated\n' >> "$MAPPING_FILE"
72+
if [ ! -f "$ISSUES_MAPPING_FILE" ]; then
73+
info "$ISSUES_MAPPING_FILE doesn't exist. Creating..."
74+
printf 'Id\tIssue\tState\tCreated\n' >> "$ISSUES_MAPPING_FILE"
7575
else
76-
info "$MAPPING_FILE exists"
76+
info "$ISSUES_MAPPING_FILE exists"
7777
fi
7878

7979
[ -f "$DIR/todos-in-code.tsv" ] || fatal "$DIR/todos-in-code.tsv doesn't exists!"
@@ -92,7 +92,7 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
9292
TITLE="$(echo "$TITLE" | sed -e 's|^"||;' -e 's|"$||' -e 's|""|"|g')"
9393

9494
debug "$PUZZLE_ID: has title: '$TITLE'"
95-
MAPPING="$(grep --max-count=1 "^${PUZZLE_ID}[[:space:]]" "$MAPPING_FILE" || :)"
95+
MAPPING="$(grep --max-count=1 "^${PUZZLE_ID}[[:space:]]" "$ISSUES_MAPPING_FILE" || :)"
9696
if [ -n "$MAPPING" ]; then
9797
IFS=$'\t' read -r UNUSED_PUZZLE_ID ISSUE_ID UNUSED_REST <<<"$MAPPING"
9898
info "$PUZZLE_ID => #$ISSUE_ID: is already linked"
@@ -149,7 +149,7 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
149149
# UNUSED_REST is really unused but without it, read appends the rest of a line to the last variable
150150
# shellcheck disable=SC2034
151151
echo "$CANDIDATES" | while read -r ISSUE_ID ISSUE_STATE UNUSED_REST; do
152-
error " echo '$PUZZLE_ID\t$ISSUE_ID\t$ISSUE_STATE\tmanually' >>$MAPPING_FILE"
152+
error " echo '$PUZZLE_ID\t$ISSUE_ID\t$ISSUE_STATE\tmanually' >>$ISSUES_MAPPING_FILE"
153153
done
154154
fatal ''
155155
fi
@@ -178,7 +178,7 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
178178
info "$PUZZLE_ID => #$ISSUE_ID: issue has been created: $ISSUE_LINK"
179179

180180
info "$PUZZLE_ID => #$ISSUE_ID: link with $ISSUE_ID (just created)"
181-
printf '%s\t%s\topen\tautomatically\n' "$PUZZLE_ID" "$ISSUE_ID" >> "$MAPPING_FILE"
181+
printf '%s\t%s\topen\tautomatically\n' "$PUZZLE_ID" "$ISSUE_ID" >> "$ISSUES_MAPPING_FILE"
182182
NEW_ISSUES_COUNT=$((NEW_ISSUES_COUNT + 1))
183183
continue
184184
fi
@@ -226,14 +226,14 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
226226
error "Ways to resolve:"
227227
error " 1) edit $ISSUE_URL and modify its body to contain $PUZZLE_ID"
228228
error " 2) manually create a mapping between this puzzle and the issue:"
229-
error " echo '$PUZZLE_ID\t$ISSUE_ID\t$ISSUE_STATE\tmanually' >>$MAPPING_FILE"
229+
error " echo '$PUZZLE_ID\t$ISSUE_ID\t$ISSUE_STATE\tmanually' >>$ISSUES_MAPPING_FILE"
230230
fatal ''
231231
else
232232
debug "$PUZZLE_ID => #$ISSUE_ID: body contains puzzle id"
233233
fi
234234

235235
info "$PUZZLE_ID => #$ISSUE_ID: link with $ISSUE_ID ($ISSUE_STATE)"
236-
printf '%s\t%s\t%s\tautomatically\n' "$PUZZLE_ID" "$ISSUE_ID" "$ISSUE_STATE" >> "$MAPPING_FILE"
236+
printf '%s\t%s\t%s\tautomatically\n' "$PUZZLE_ID" "$ISSUE_ID" "$ISSUE_STATE" >> "$ISSUES_MAPPING_FILE"
237237
fi
238238
done <<< "$(grep -v '^Id' "$1")"
239239

0 commit comments

Comments
 (0)