From aaefce8234b043d9b53057dd4b4d52efe85dcc8b Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 13 Sep 2025 14:15:19 +0200 Subject: [PATCH] Add debug info and fallback for Claude CLI authentication issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🐛 Bug Fixes - Added debugging information for Claude CLI installation and execution - Added fallback changelog generation from commit messages - Uses --dangerously-skip-permissions flag for CI environment ### 🔧 Improvements - Workflow now continues even if Claude CLI authentication fails - Provides detailed error information for debugging - Generates basic changelog from git commits as fallback - Maintains workflow execution without requiring Claude authentication ### 📚 Documentation - Added note in fallback changelog about authentication requirements - Clear messaging about fallback vs AI-generated changelogs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/version-and-publish.yml | 30 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/version-and-publish.yml b/.github/workflows/version-and-publish.yml index 9ab5878..ba5a9b8 100644 --- a/.github/workflows/version-and-publish.yml +++ b/.github/workflows/version-and-publish.yml @@ -120,6 +120,13 @@ jobs: fi echo "🤖 Generating changelog with Claude..." + + # Debug Claude CLI installation + echo "🔍 Debugging Claude CLI..." + which claude || echo "Claude not in PATH" + claude --version || echo "Claude version check failed" + + # Try Claude CLI first, fallback to manual changelog if it fails PROMPT="Please analyze the following git commits and generate a concise changelog in this exact format: ## Changes @@ -144,17 +151,32 @@ jobs: Git commits to analyze: $COMMITS" - CHANGELOG=$(timeout 240s claude -p "$PROMPT") + # Try Claude CLI with authentication bypass for CI + if claude -p --dangerously-skip-permissions "$PROMPT" > /tmp/changelog.txt 2>/tmp/claude_error.txt; then + CHANGELOG=$(cat /tmp/changelog.txt) + echo "✅ Successfully generated changelog with Claude CLI" + else + echo "⚠️ Claude CLI failed, using fallback changelog generation" + cat /tmp/claude_error.txt || echo "No error details available" + + # Fallback: Generate changelog from commit messages + CHANGELOG="## Changes + + ### 🔧 Improvements + $(echo "$COMMITS" | sed 's/^[a-f0-9]* /- /' | head -10) + + *Note: This changelog was generated automatically from commit messages. For detailed AI-generated changelogs, Claude CLI authentication would be needed.*" + fi # Check if changelog generation succeeded - if [ $? -ne 0 ] || [ -z "$CHANGELOG" ]; then - echo "❌ ERROR: Failed to generate changelog with Claude. Workflow cannot continue." + if [ -z "$CHANGELOG" ]; then + echo "❌ ERROR: Failed to generate any changelog. Workflow cannot continue." echo "Debug info - Commits to analyze:" echo "$COMMITS" exit 1 fi - echo "✅ Successfully generated changelog with Claude" + echo "✅ Changelog generation completed" # Save changelog to output echo "changelog<> $GITHUB_OUTPUT