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

fix(ci): do not check closed issues in main job #12066

Merged
merged 1 commit into from
Sep 23, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ jobs:
working_directory: packages/contracts-bedrock

todo-issues:
parameters:
check_closed:
type: boolean
default: true
machine:
image: <<pipeline.parameters.base_image>>
steps:
Expand All @@ -723,7 +727,7 @@ jobs:
command: sudo apt-get install -y ripgrep
- run:
name: Check TODO issues
command: ./ops/scripts/todo-checker.sh --verbose
command: ./ops/scripts/todo-checker.sh --verbose <<#parameters.check_closed>> --check-closed <</parameters.check_closed>>
- notify-failures-on-develop

fuzz-golang:
Expand Down Expand Up @@ -1709,6 +1713,7 @@ workflows:
- cannon-build-test-vectors
- todo-issues:
name: todo-issues-check
check_closed: false
- shellcheck/check:
name: shell-check
# We don't need the `exclude` key as the orb detects the `.shellcheckrc`
Expand Down
16 changes: 12 additions & 4 deletions ops/scripts/todo-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -uo pipefail
# Flags
FAIL_INVALID_FMT=false
VERBOSE=false
CHECK_CLOSED=false

# Github API access token (Optional - necessary for private repositories.)
GH_API_TOKEN="${CI_TODO_CHECKER_PAT:-""}"
Expand Down Expand Up @@ -36,6 +37,7 @@ NC='\033[0m' # No Color
#
# `--strict`: Toggle strict mode; Will fail if any TODOs are found that don't match the expected
# `--verbose`: Toggle verbose mode; Will print out details about each TODO
# `--check-closed`: Check for closed issues and error out if found
for arg in "$@"; do
case $arg in
--strict)
Expand All @@ -46,6 +48,10 @@ for arg in "$@"; do
VERBOSE=true
shift
;;
--check-closed)
CHECK_CLOSED=true
shift
;;
esac
done

Expand Down Expand Up @@ -104,14 +110,16 @@ for todo in $todos; do
# Check issue state
STATE=$(echo "$RESPONSE" | jq -r .state)

if [[ "$STATE" == "closed" ]]; then
if [[ "$STATE" == "closed" ]] && $CHECK_CLOSED; then
echo -e "${RED}[Error]:${NC} Issue #$ISSUE_NUM is closed. Please remove the TODO in ${GREEN}$FILE:$LINE_NUM${NC} referencing ${YELLOW}$ISSUE_REFERENCE${NC} (${CYAN}https://github.com/$GH_URL_PATH${NC})"
exit 1
fi

((OPEN_COUNT++))
TITLE=$(echo "$RESPONSE" | jq -r .title)
OPEN_ISSUES+=("$REPO_FULL/issues/$ISSUE_NUM|$TITLE|$FILE:$LINE_NUM")
if [[ "$STATE" == "open" ]]; then
((OPEN_COUNT++))
TITLE=$(echo "$RESPONSE" | jq -r .title)
OPEN_ISSUES+=("$REPO_FULL/issues/$ISSUE_NUM|$TITLE|$FILE:$LINE_NUM")
fi
done

# Print summary
Expand Down