Skip to content

🚨 ArgoCD Deployment Failed: this-app-is-broken #13

🚨 ArgoCD Deployment Failed: this-app-is-broken

🚨 ArgoCD Deployment Failed: this-app-is-broken #13

name: Trigger Cluster Doctor
# Modified from @sitoader's workflow at: https://github.com/sitoader/AgenticWorkflows/blob/main/.github/workflows/generate-docs.yml
on:
workflow_dispatch:
issues:
types: [labeled]
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
ARM_USE_OIDC: true
permissions:
id-token: write
contents: read
issues: write
jobs:
run-cluster-doctor:
if: github.event_name == 'workflow_dispatch' || github.event.label.name == 'cluster-doctor'
environment: copilot
runs-on: ubuntu-latest
permissions:
id-token: write # Required to do OIDC workfload federation token exchange with Azure
contents: write # Required to read repository content and commit diffs
issues: write # Required to create GitHub issues for documentation recommendations
pull-requests: write # Required to create PRs if needed
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Parse cluster info from label or inputs
id: cluster-info
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Use workflow inputs
echo "RESOURCE_GROUP=${{ github.event.inputs.resource_group }}" >> $GITHUB_OUTPUT
echo "CLUSTER_NAME=${{ github.event.inputs.cluster_name }}" >> $GITHUB_OUTPUT
echo "Using workflow inputs: RG=${{ github.event.inputs.resource_group }}, Cluster=${{ github.event.inputs.cluster_name }}"
else
# Parse from label: cluster/<resource-group>/<cluster-name>
LABEL="${{ github.event.label.name }}"
echo "Parsing label: $LABEL"
# Extract resource group and cluster name from label
# Expected format: cluster/<resource-group>/<cluster-name>
RESOURCE_GROUP=$(echo "$LABEL" | cut -d'/' -f2)
CLUSTER_NAME=$(echo "$LABEL" | cut -d'/' -f3)
if [ -z "$RESOURCE_GROUP" ] || [ -z "$CLUSTER_NAME" ]; then
echo "ERROR: Invalid label format. Expected: cluster/<resource-group>/<cluster-name>"
echo "Got: $LABEL"
exit 1
fi
echo "RESOURCE_GROUP=$RESOURCE_GROUP" >> $GITHUB_OUTPUT
echo "CLUSTER_NAME=$CLUSTER_NAME" >> $GITHUB_OUTPUT
echo "Parsed from label: RG=$RESOURCE_GROUP, Cluster=$CLUSTER_NAME"
fi
- name: Install GitHub Copilot CLI
run: |
curl -fsSL https://gh.io/copilot-install | bash
echo "Installed Copilot CLI version:"
copilot --version
- name: Azure CLI Login
uses: azure/login@v2
with:
client-id: ${{ secrets.ARM_CLIENT_ID }}
tenant-id: ${{ secrets.ARM_TENANT_ID }}
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
- name: Verify Azure Login
run: |
echo "Verifying Azure authentication..."
az account show
- name: Get AKS Credentials
run: |
echo "Fetching kubeconfig for cluster ${{ steps.cluster-info.outputs.CLUSTER_NAME }}..."
az aks get-credentials \
--resource-group ${{ steps.cluster-info.outputs.RESOURCE_GROUP }} \
--name ${{ steps.cluster-info.outputs.CLUSTER_NAME }} \
--overwrite-existing
echo "Kubeconfig fetched successfully!"
kubectl cluster-info
kubectl port-forward -n aks-mcp svc/aks-mcp 8000:8000 &
sleep 3 # Wait for port-forward to establish
- name: Analyze and delegate to Copilot
env:
GITHUB_MCP_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Workflow token for MCP GitHub operations (issues)
GITHUB_TOKEN: ${{ secrets.COPILOT_CLI_TOKEN }} # Personal PAT for Copilot API authentication
run: |
echo "Analyzing issue #${{ github.event.issue.number }}"
echo "Loading documentation criteria from prompt..."
export PROMPT="Use the GitHub MCP Server to help analyze GitHub Issue #${{ github.event.issue.number }} in the repository ${{ github.repository }}. Any changes or fixes should be documented back in the GitHub Issue as a comment in the thread, and use GitHub MCP server to create a PR should any material changes to the repo be made as part of the fix and noted as part of the issue comment response, also via GitHub MCP server. Leverage the AKS MCP server to get additional information to verify the issue and details about the AKS cluster."
echo "Delegating to GitHub Copilot..."
echo "- Copilot will use MCP to examine the issue"
echo "- Copilot will decide if changes are needed"
echo "- Copilot will create an issue comment, PR and link them as needed."
echo ""
copilot -p "$PROMPT" \
--agent "cluster-doctor" \
--additional-mcp-config @'.copilot/mcp-config.json' \
--allow-all-tools