Commit f86ccc83 authored by smartcontracts's avatar smartcontracts Committed by GitHub

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

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.
parent d204c1f1
...@@ -714,6 +714,10 @@ jobs: ...@@ -714,6 +714,10 @@ jobs:
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
todo-issues: todo-issues:
parameters:
check_closed:
type: boolean
default: true
machine: machine:
image: <<pipeline.parameters.base_image>> image: <<pipeline.parameters.base_image>>
steps: steps:
...@@ -723,7 +727,7 @@ jobs: ...@@ -723,7 +727,7 @@ jobs:
command: sudo apt-get install -y ripgrep command: sudo apt-get install -y ripgrep
- run: - run:
name: Check TODO issues 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 - notify-failures-on-develop
fuzz-golang: fuzz-golang:
...@@ -1709,6 +1713,7 @@ workflows: ...@@ -1709,6 +1713,7 @@ workflows:
- cannon-build-test-vectors - cannon-build-test-vectors
- todo-issues: - todo-issues:
name: todo-issues-check name: todo-issues-check
check_closed: false
- shellcheck/check: - shellcheck/check:
name: shell-check name: shell-check
# We don't need the `exclude` key as the orb detects the `.shellcheckrc` # We don't need the `exclude` key as the orb detects the `.shellcheckrc`
......
...@@ -5,6 +5,7 @@ set -uo pipefail ...@@ -5,6 +5,7 @@ set -uo pipefail
# Flags # Flags
FAIL_INVALID_FMT=false FAIL_INVALID_FMT=false
VERBOSE=false VERBOSE=false
CHECK_CLOSED=false
# Github API access token (Optional - necessary for private repositories.) # Github API access token (Optional - necessary for private repositories.)
GH_API_TOKEN="${CI_TODO_CHECKER_PAT:-""}" GH_API_TOKEN="${CI_TODO_CHECKER_PAT:-""}"
...@@ -36,6 +37,7 @@ NC='\033[0m' # No Color ...@@ -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 # `--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 # `--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 for arg in "$@"; do
case $arg in case $arg in
--strict) --strict)
...@@ -46,6 +48,10 @@ for arg in "$@"; do ...@@ -46,6 +48,10 @@ for arg in "$@"; do
VERBOSE=true VERBOSE=true
shift shift
;; ;;
--check-closed)
CHECK_CLOSED=true
shift
;;
esac esac
done done
...@@ -104,14 +110,16 @@ for todo in $todos; do ...@@ -104,14 +110,16 @@ for todo in $todos; do
# Check issue state # Check issue state
STATE=$(echo "$RESPONSE" | jq -r .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})" 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 exit 1
fi fi
if [[ "$STATE" == "open" ]]; then
((OPEN_COUNT++)) ((OPEN_COUNT++))
TITLE=$(echo "$RESPONSE" | jq -r .title) TITLE=$(echo "$RESPONSE" | jq -r .title)
OPEN_ISSUES+=("$REPO_FULL/issues/$ISSUE_NUM|$TITLE|$FILE:$LINE_NUM") OPEN_ISSUES+=("$REPO_FULL/issues/$ISSUE_NUM|$TITLE|$FILE:$LINE_NUM")
fi
done done
# Print summary # Print summary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment