diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f037f6968e2..798396de14b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2073,3 +2073,148 @@ jobs: name: safe-outputs-conformance-report path: conformance-output.txt retention-days: 7 + + integration-add: + name: Integration Add Workflows + runs-on: ubuntu-latest + permissions: + contents: read + concurrency: + group: ci-${{ github.ref }}-integration-add + cancel-in-progress: true + steps: + - name: Checkout code + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 + + - name: Set up Go + id: setup-go + uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6 + with: + go-version-file: go.mod + cache: true + + - name: Report Go cache status + run: | + if [ "${{ steps.setup-go.outputs.cache-hit }}" == "true" ]; then + echo "✅ Go cache hit" >> $GITHUB_STEP_SUMMARY + else + echo "⚠️ Go cache miss" >> $GITHUB_STEP_SUMMARY + fi + + - name: Download dependencies + run: go mod download + + - name: Verify dependencies + run: go mod verify + + - name: Build gh-aw binary + run: make build + + - name: Verify gh-aw binary + run: | + ./gh-aw --help + ./gh-aw version + + - name: Clone githubnext/agentics repository + run: | + echo "Cloning githubnext/agentics repository..." + cd /tmp + git clone --depth 1 --filter=blob:none https://github.com/githubnext/agentics.git + echo "✅ Repository cloned successfully" + + - name: List workflows from agentics + id: list-workflows + run: | + echo "Listing workflow files from githubnext/agentics..." + cd /tmp/agentics/workflows + + # Get list of all .md workflow files (just the names without .md extension) + WORKFLOWS=$(ls *.md | sed 's/\.md$//') + + echo "Found workflows:" + echo "$WORKFLOWS" + + # Count workflows + WORKFLOW_COUNT=$(echo "$WORKFLOWS" | wc -l) + echo "Total workflows found: $WORKFLOW_COUNT" + + # Save workflow list for next step + echo "$WORKFLOWS" > /tmp/workflow-list.txt + echo "workflow_count=$WORKFLOW_COUNT" >> $GITHUB_OUTPUT + + - name: Add workflows one by one + id: add-workflows + env: + GH_TOKEN: ${{ github.token }} + run: | + cd /home/runner/work/gh-aw/gh-aw + + echo "## Adding Workflows from githubnext/agentics" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "| Workflow | Status | Details |" >> $GITHUB_STEP_SUMMARY + echo "|----------|--------|---------|" >> $GITHUB_STEP_SUMMARY + + SUCCESS_COUNT=0 + FAILURE_COUNT=0 + + # Read workflow list + while IFS= read -r workflow; do + echo "Processing workflow: $workflow" + + # Try to add the workflow using gh aw add + if ./gh-aw add "githubnext/agentics/$workflow" --force 2>&1 | tee /tmp/add-${workflow}.log; then + echo "✅ Successfully added: $workflow" + echo "| $workflow | ✅ Success | Added successfully |" >> $GITHUB_STEP_SUMMARY + SUCCESS_COUNT=$((SUCCESS_COUNT + 1)) + else + EXIT_CODE=$? + echo "❌ Failed to add: $workflow (exit code: $EXIT_CODE)" + + # Extract error message from log + ERROR_MSG=$(tail -5 /tmp/add-${workflow}.log | tr '\n' ' ' | cut -c1-100) + echo "| $workflow | ❌ Failed | Exit code: $EXIT_CODE - ${ERROR_MSG}... |" >> $GITHUB_STEP_SUMMARY + FAILURE_COUNT=$((FAILURE_COUNT + 1)) + fi + + echo "---" + done < /tmp/workflow-list.txt + + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Summary" >> $GITHUB_STEP_SUMMARY + echo "- ✅ Successful: $SUCCESS_COUNT" >> $GITHUB_STEP_SUMMARY + echo "- ❌ Failed: $FAILURE_COUNT" >> $GITHUB_STEP_SUMMARY + echo "- Total: ${{ steps.list-workflows.outputs.workflow_count }}" >> $GITHUB_STEP_SUMMARY + + echo "success_count=$SUCCESS_COUNT" >> $GITHUB_OUTPUT + echo "failure_count=$FAILURE_COUNT" >> $GITHUB_OUTPUT + + # Report overall result + echo "" + echo "=====================================" + echo "Integration Test Results" + echo "=====================================" + echo "Successful additions: $SUCCESS_COUNT" + echo "Failed additions: $FAILURE_COUNT" + echo "Total workflows: ${{ steps.list-workflows.outputs.workflow_count }}" + echo "=====================================" + + - name: Check for added workflows + run: | + echo "Checking for added workflow files..." + if [ -d ".github/workflows" ]; then + echo "Found workflows directory" + ls -la .github/workflows/*.md 2>/dev/null | head -20 || echo "No .md files found" + else + echo "No .github/workflows directory found" + fi + + - name: Test result summary + if: always() + run: | + echo "=== Agentics Workflows Integration Test Summary ===" + echo "This test validates that gh-aw can successfully add workflows" + echo "from the githubnext/agentics repository." + echo "" + echo "Test completed with:" + echo "- Success count: ${{ steps.add-workflows.outputs.success_count }}" + echo "- Failure count: ${{ steps.add-workflows.outputs.failure_count }}"