Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | name: Docs Health Check |
| 2 | |
| 3 | on: |
| 4 | schedule: |
| 5 | - cron: '0 * * * *' # Every hour |
| 6 | workflow_dispatch: # Manual trigger |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | |
| 11 | jobs: |
| 12 | health-check: |
| 13 | name: Check docs accessibility |
| 14 | runs-on: ubuntu-latest |
| 15 | steps: |
| 16 | - name: Check endpoints |
| 17 | id: check |
| 18 | run: | |
| 19 | BASE_URL="https://docs.composio.dev" |
| 20 | FAIL_FILE=$(mktemp) |
| 21 | BODY_FILE=$(mktemp) |
| 22 | CHECKED=0 |
| 23 | FAIL_COUNT=0 |
| 24 | |
| 25 | check_url() { |
| 26 | local label="$1" |
| 27 | local url="$2" |
| 28 | shift 2 |
| 29 | local expected_status="" |
| 30 | if [[ "${1:-}" =~ ^[0-9]{3}$ ]]; then |
| 31 | expected_status="$1" |
| 32 | shift |
| 33 | fi |
| 34 | CHECKED=$((CHECKED + 1)) |
| 35 | local attempt=0 |
| 36 | local STATUS="000" |
| 37 | while [ "$attempt" -lt 2 ]; do |
| 38 | if STATUS=$(curl -sL -o /dev/null -w "%{http_code}" --max-time 15 "$@" "$url" 2>/dev/null); then |
| 39 | : |
| 40 | else |
| 41 | STATUS="000" |
| 42 | fi |
| 43 | if [ -n "$expected_status" ]; then |
| 44 | [ "$STATUS" = "$expected_status" ] && break |
| 45 | elif [ "$STATUS" != "000" ] && [ "$STATUS" -lt 400 ]; then |
| 46 | break |
| 47 | fi |
| 48 | attempt=$((attempt + 1)) |
| 49 | [ "$attempt" -lt 2 ] && sleep 3 |
| 50 | done |
| 51 | if [ -n "$expected_status" ]; then |
| 52 | if [ "$STATUS" != "$expected_status" ]; then |
| 53 | echo "FAIL: ${label} → ${STATUS} (expected ${expected_status})" |
| 54 | echo "${label} → ${STATUS} (expected ${expected_status})" >> "$FAIL_FILE" |
| 55 | FAIL_COUNT=$((FAIL_COUNT + 1)) |
| 56 | else |
| 57 | echo " OK: ${label} → ${STATUS}" |
| 58 | fi |
| 59 | elif [ "$STATUS" = "000" ] || [ "$STATUS" -ge 400 ]; then |
| 60 | echo "FAIL: ${label} → ${STATUS}" |
| 61 | echo "${label} → ${STATUS}" >> "$FAIL_FILE" |
| 62 | FAIL_COUNT=$((FAIL_COUNT + 1)) |
| 63 | else |
| 64 | echo " OK: ${label} → ${STATUS}" |
| 65 | fi |
| 66 | } |
| 67 | |
| 68 | check_json_url() { |
| 69 | local label="$1" |
| 70 | local url="$2" |
| 71 | local expression="$3" |
| 72 | shift 3 |
| 73 | CHECKED=$((CHECKED + 1)) |
| 74 | local attempt=0 |
| 75 | local STATUS="000" |
| 76 | local HEALTHY="false" |
| 77 | while [ "$attempt" -lt 2 ]; do |
| 78 | if STATUS=$(curl -sL -o "$BODY_FILE" -w "%{http_code}" --max-time 15 "$@" "$url" 2>/dev/null); then |
| 79 | : |
| 80 | else |
| 81 | STATUS="000" |
| 82 | fi |
| 83 | if [ "$STATUS" -lt 400 ] 2>/dev/null && jq -e "$expression" "$BODY_FILE" > /dev/null 2>&1; then |
| 84 | HEALTHY="true" |
| 85 | break |
| 86 | fi |
| 87 | attempt=$((attempt + 1)) |
| 88 | [ "$attempt" -lt 2 ] && sleep 3 |
| 89 | done |
| 90 | if [ "$HEALTHY" = "true" ]; then |
| 91 | echo " OK: ${label} → ${STATUS} (valid JSON)" |
| 92 | else |
| 93 | echo "FAIL: ${label} → ${STATUS} (invalid response)" |
| 94 | echo "${label} → ${STATUS} (invalid response)" >> "$FAIL_FILE" |
| 95 | FAIL_COUNT=$((FAIL_COUNT + 1)) |
| 96 | fi |
| 97 | } |
| 98 | |
| 99 | # LLM/AI agent entry points |
| 100 | check_url "/llms.txt" "${BASE_URL}/llms.txt" |
| 101 | check_url "/llms-full.txt" "${BASE_URL}/llms-full.txt" |
| 102 | check_url "/docs/quickstart.md" "${BASE_URL}/docs/quickstart.md" |
| 103 | check_url "/docs/how-composio-works.md" "${BASE_URL}/docs/how-composio-works.md" |
| 104 | |
| 105 | # Main pages |
| 106 | check_url "/docs" "${BASE_URL}/docs" |
| 107 | check_url "/docs/quickstart" "${BASE_URL}/docs/quickstart" |
| 108 | check_url "/docs/authentication" "${BASE_URL}/docs/authentication" |
| 109 | check_url "/docs/tools-and-toolkits" "${BASE_URL}/docs/tools-and-toolkits" |
| 110 | check_url "/docs/users-and-sessions" "${BASE_URL}/docs/users-and-sessions" |
| 111 | check_url "/docs/configuring-sessions" "${BASE_URL}/docs/configuring-sessions" |
| 112 | check_url "/cookbooks" "${BASE_URL}/cookbooks" |
| 113 | check_url "/toolkits" "${BASE_URL}/toolkits" |
| 114 | check_url "/toolkits/github" "${BASE_URL}/toolkits/github" 200 |
| 115 | check_url "/toolkits/__definitely-not-a-toolkit__" \ |
| 116 | "${BASE_URL}/toolkits/__definitely-not-a-toolkit__" 404 |
| 117 | check_url "/reference" "${BASE_URL}/reference" |
| 118 | |
| 119 | # Public support knowledge |
| 120 | check_url "/kb" "${BASE_URL}/kb" |
| 121 | check_url "/kb/search" "${BASE_URL}/kb/search?q=github%20oauth" |
| 122 | check_json_url "/api/knowledge-search" \ |
| 123 | "${BASE_URL}/api/knowledge-search?q=github%20oauth&filter=kb" \ |
| 124 | '.query == "github oauth" and .filter == "kb" and (.results | type == "array") and .mode == "hybrid"' \ |
| 125 | -H "Cache-Control: no-cache" |
| 126 | |
| 127 | # Provider pages |
| 128 | check_url "/docs/providers/openai" "${BASE_URL}/docs/providers/openai" |
| 129 | check_url "/docs/providers/vercel" "${BASE_URL}/docs/providers/vercel" |
| 130 | check_url "/docs/providers/anthropic" "${BASE_URL}/docs/providers/anthropic" |
| 131 | |
| 132 | # Key sub-pages |
| 133 | check_url "/docs/tools-direct/fetching-tools" "${BASE_URL}/docs/tools-direct/fetching-tools" |
| 134 | check_url "/docs/tools-direct/executing-tools" "${BASE_URL}/docs/tools-direct/executing-tools" |
| 135 | check_url "/docs/authenticating-users/in-chat-authentication" "${BASE_URL}/docs/authenticating-users/in-chat-authentication" |
| 136 | check_url "/docs/common-faq" "${BASE_URL}/docs/common-faq" |
| 137 | |
| 138 | # Markdown content negotiation |
| 139 | check_url "/docs/quickstart (markdown)" "${BASE_URL}/docs/quickstart" -H "Accept: text/markdown" |
| 140 | check_url "/docs/tools-and-toolkits (markdown)" "${BASE_URL}/docs/tools-and-toolkits" -H "Accept: text/markdown" |
| 141 | check_url "/docs/authentication (markdown)" "${BASE_URL}/docs/authentication" -H "Accept: text/markdown" |
| 142 | check_url "/docs/providers/openai (markdown)" "${BASE_URL}/docs/providers/openai" -H "Accept: text/markdown" |
| 143 | check_url "/cookbooks (markdown)" "${BASE_URL}/cookbooks" -H "Accept: text/markdown" |
| 144 | |
| 145 | if [ "$FAIL_COUNT" -gt 0 ]; then |
| 146 | echo "has_failures=true" >> $GITHUB_OUTPUT |
| 147 | |
| 148 | # Build the Slack message with real newlines |
| 149 | FAIL_LIST=$(sed 's/^/• /' "$FAIL_FILE") |
| 150 | RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |
| 151 | |
| 152 | PAYLOAD=$(jq -n \ |
| 153 | --arg fails "$FAIL_LIST" \ |
| 154 | --arg count "$FAIL_COUNT" \ |
| 155 | --arg total "$CHECKED" \ |
| 156 | --arg url "$RUN_URL" \ |
| 157 | '{text: ("🚨 *Docs Health Check*\n\n" + $count + "/" + $total + " endpoints failing:\n" + $fails + "\n\n<" + $url + "|View logs>")}') |
| 158 | |
| 159 | echo "slack_payload<<EOF" >> $GITHUB_OUTPUT |
| 160 | echo "$PAYLOAD" >> $GITHUB_OUTPUT |
| 161 | echo "EOF" >> $GITHUB_OUTPUT |
| 162 | else |
| 163 | echo "has_failures=false" >> $GITHUB_OUTPUT |
| 164 | echo "All $CHECKED endpoints healthy" |
| 165 | fi |
| 166 | |
| 167 | rm -f "$FAIL_FILE" "$BODY_FILE" |
| 168 | |
| 169 | - name: Notify Slack |
| 170 | if: steps.check.outputs.has_failures == 'true' |
| 171 | uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0 |
| 172 | with: |
| 173 | webhook: ${{ secrets.SLACK_POD_DX_WEBHOOK_URL }} |
| 174 | webhook-type: incoming-webhook |
| 175 | payload: ${{ steps.check.outputs.slack_payload }} |
| 176 | |
| 177 | - name: Fail on unhealthy endpoints |
| 178 | if: steps.check.outputs.has_failures == 'true' |
| 179 | run: exit 1 |