Skip to content

Commit

Permalink
fix(ci): do not check closed issues in main job
Browse files Browse the repository at this point in the history
Updates the todo-checker to not check for closed issues in the
main job. Will still check for closed issues in the scheduled job.
Prevents CI from randomly failing when stuff gets closed.
  • Loading branch information
smartcontracts committed Sep 23, 2024
1 parent d204c1f commit 821d451
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
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

0 comments on commit 821d451

Please sign in to comment.