Skip to content

Commit dca86bf

Browse files
committed
refactor: extract variable CODE_MAPPING_FILE
Relate to #1610
1 parent 5f32d2b commit dca86bf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ else
7676
info "$ISSUES_MAPPING_FILE exists"
7777
fi
7878

79-
[ -f "$DIR/todos-in-code.tsv" ] || fatal "$DIR/todos-in-code.tsv doesn't exists!"
79+
CODE_MAPPING_FILE="$1"
80+
[ -f "$CODE_MAPPING_FILE" ] || fatal "$CODE_MAPPING_FILE doesn't exists!"
81+
8082
[ -n "${GITHUB_SHA:-}" ] || fatal 'GITHUB_SHA env variable is not set!'
8183
[ -n "${GITHUB_REPOSITORY:-}" ] || fatal 'GITHUB_REPOSITORY env variable is not set!'
8284

@@ -159,7 +161,7 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
159161

160162
# These variables are needed for eval-ing ISSUE_BODY_TEMPLATE
161163
# shellcheck disable=SC2034
162-
IFS=$'\t' read -r UNUSED_PUZZLE_ID ORIG_ISSUE UNUSED_TITLE PUZZLE_FILE PUZZLE_LINES < <(grep --max-count=1 "^$PUZZLE_ID" "$DIR/todos-in-code.tsv")
164+
IFS=$'\t' read -r UNUSED_PUZZLE_ID ORIG_ISSUE UNUSED_TITLE PUZZLE_FILE PUZZLE_LINES < <(grep --max-count=1 "^$PUZZLE_ID" "$CODE_MAPPING_FILE")
163165

164166
# "50-51" => {50, 51}
165167
# These variables are needed for eval-ing ISSUE_BODY_TEMPLATE
@@ -235,7 +237,7 @@ while IFS=$'\t' read -r PUZZLE_ID UNUSED_TICKET TITLE UNUSED_REST; do
235237
info "$PUZZLE_ID => #$ISSUE_ID: link with $ISSUE_ID ($ISSUE_STATE)"
236238
printf '%s\t%s\t%s\tautomatically\n' "$PUZZLE_ID" "$ISSUE_ID" "$ISSUE_STATE" >> "$ISSUES_MAPPING_FILE"
237239
fi
238-
done <<< "$(grep -v '^Id' "$1")"
240+
done <<< "$(grep -v '^Id' "$CODE_MAPPING_FILE")"
239241

240242
info ''
241243
info 'DONE'

0 commit comments

Comments
 (0)