From 821d4513faedb4d3625ccf8bda5549dee4f616ec Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Mon, 23 Sep 2024 15:31:39 -0400 Subject: [PATCH] fix(ci): do not check closed issues in main job 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. --- .circleci/config.yml | 7 ++++++- ops/scripts/todo-checker.sh | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4975442dd87..dccd91867d5b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -714,6 +714,10 @@ jobs: working_directory: packages/contracts-bedrock todo-issues: + parameters: + check_closed: + type: boolean + default: true machine: image: <> steps: @@ -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 <> - notify-failures-on-develop fuzz-golang: @@ -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` diff --git a/ops/scripts/todo-checker.sh b/ops/scripts/todo-checker.sh index 4aebcf1a957d..6b144ec200cf 100755 --- a/ops/scripts/todo-checker.sh +++ b/ops/scripts/todo-checker.sh @@ -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:-""}" @@ -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) @@ -46,6 +48,10 @@ for arg in "$@"; do VERBOSE=true shift ;; + --check-closed) + CHECK_CLOSED=true + shift + ;; esac done @@ -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