Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/script/update-required-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
echo "Getting checks for $GITHUB_SHA"

# Ignore any checks with "https://", CodeQL, LGTM, Update, and ESLint checks.
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs.[] | select(.conclusion != "skipped") | .name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("ESLint") or contains("update") or contains("test-setup-python-scripts") | not)] | unique | sort')"
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output '[.[].check_runs.[] | select(.conclusion != "skipped") | .name | select(contains("https://") or . == "CodeQL" or . == "Dependabot" or . == "check-expected-release-files" or contains("Update") or contains("ESLint") or contains("update") or contains("test-setup-python-scripts") or . == "Agent" or . == "Cleanup artifacts" or . == "Prepare" or . == "Upload results" | not)] | unique | sort')"
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The jq filter has become very long and difficult to maintain with multiple exact matches mixed with substring matches. Consider refactoring this into a more maintainable pattern, such as defining an array of patterns to exclude or breaking the complex filter into multiple steps for clarity.

See below for a potential fix:

# Define exclusion patterns for check names (exact matches and substrings)
EXCLUDE_PATTERNS=('https://' 'CodeQL' 'Dependabot' 'check-expected-release-files' 'Update' 'ESLint' 'update' 'test-setup-python-scripts' 'Agent' 'Cleanup artifacts' 'Prepare' 'Upload results')

# Convert bash array to jq array
EXCLUDE_PATTERNS_JQ=$(printf '"%s",' "${EXCLUDE_PATTERNS[@]}" | sed 's/,$//')

# Use jq to filter out checks matching any exclusion pattern
CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs --paginate | jq --slurp --compact-output --raw-output --argjson exclude_patterns "[$EXCLUDE_PATTERNS_JQ]" '
  [.[].check_runs.[] 
    | select(.conclusion != "skipped") 
    | .name 
    | select(
        [ 
          $exclude_patterns[] 
          | (. as $pat 
            | if ($pat | test("^https://")) 
              then (. | contains($pat)) 
              else (. == $pat or . | contains($pat)) 
            end
          )
        ] 
        | any
      ) | not
    )
  ] | unique | sort
')"

Copilot uses AI. Check for mistakes.

echo "$CHECKS" | jq

Expand Down
Loading