ci: add nightly failure issue alerts#3293
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a bash script and a corresponding test suite to automate the management of GitHub issues for nightly workflow alerts. The script handles creating, updating, or closing issues based on workflow results and includes logic to extract failure excerpts from logs. Feedback suggests increasing the search limit and using quoted titles in the gh issue list command to more reliably identify existing alert issues and prevent duplicates in repositories with many open issues.
| gh issue list \ | ||
| --repo "$REPO" \ | ||
| --state open \ | ||
| --search "${title} in:title" \ | ||
| --json number,title \ | ||
| --jq 'map(select(.title == env.ALERT_ISSUE_TITLE))[0].number // empty' |
There was a problem hiding this comment.
The default limit for gh issue list is 30. In repositories with a high volume of open issues, the existing alert issue might be missed if it was created some time ago and is no longer among the 30 most recently created or updated issues. Increasing the limit (e.g., to 100) and using a quoted search term for the title will improve the reliability of finding the correct issue to update, preventing duplicate alerts.
| gh issue list \ | |
| --repo "$REPO" \ | |
| --state open \ | |
| --search "${title} in:title" \ | |
| --json number,title \ | |
| --jq 'map(select(.title == env.ALERT_ISSUE_TITLE))[0].number // empty' | |
| gh issue list \ | |
| --repo "$REPO" \ | |
| --state open \ | |
| --limit 100 \ | |
| --search "\"$title\" in:title" \ | |
| --json number,title \ | |
| --jq 'map(select(.title == env.ALERT_ISSUE_TITLE))[0].number // empty' |
Summary
Verification
bash -n .github/scripts/nightly-alert-issue.sh .github/scripts/nightly-alert-issue.test.sh.github/scripts/nightly-alert-issue.test.shgit diff --checkruby -e 'require "yaml"; ARGV.each { |f| YAML.load_file(f); puts "parsed #{f}" }' .github/workflows/e2e.yml .github/workflows/nightly-deep-ci.ymlNotes