ci: fix deps-bump discover job failing on empty branch list#755
Merged
Conversation
The discover step runs under `set -euo pipefail`. On the daily "no open Dependabot alerts" path, LIST is empty, so `grep -v '^$'` matched no lines and exited 1; pipefail propagated the failure and `set -e` aborted the step — turning the healthy no-op into a failed run every day. Replace the grep with jq-based empty-line filtering so the empty case yields `[]` (exit 0) and the bump job skips cleanly via its existing `branches != '[]'` guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HSjF27DDtZnihmQxHYKk4u
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Dependency Bump (Claude) workflow has been failing every day. The daily cron (
0 13 * * *) runs thediscoverjob, which checks for open Dependabot alerts. When there are none — the normal outcome most days — the script logsNo open Dependabot alerts — nothing to do., setsLIST="", then hits:BRANCHES="$(printf '%s\n' "$LIST" | grep -v '^$' | jq -R . | jq -cs .)"Under
set -euo pipefail,grep -v '^$'matches no lines and exits 1;pipefailpropagates the failure andset -eaborts the step. The healthy no-op path is reported as a ❌ failed run.This is not an auth problem — the logs show the App token reads the alerts API successfully (count
0, not theERRfallback).Fix
Drop the fragile
grepand letjqfilter empty lines, which is robust underpipefail:BRANCHES="$(printf '%s\n' "$LIST" | jq -R . | jq -cs 'map(select(length > 0))')"LIST→[](exit 0); thebumpjob skips cleanly via its existingbranches != '[]'guard.LIST→["main","dev/1.4.0", ...](exit 0), unchanged behavior.Verified both paths locally and confirmed the YAML still parses.
🤖 Generated with Claude Code