From b77edec8a49ceb8c8584764c2eacec8ffbc2e59d Mon Sep 17 00:00:00 2001 From: Henrik Neef Date: Sun, 16 Nov 2025 13:12:46 +0100 Subject: [PATCH] =?UTF-8?q?.gitea/workflows/test-telegram.yml=20gel=C3=B6s?= =?UTF-8?q?cht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/test-telegram.yml | 93 ------------------------------ 1 file changed, 93 deletions(-) delete mode 100644 .gitea/workflows/test-telegram.yml diff --git a/.gitea/workflows/test-telegram.yml b/.gitea/workflows/test-telegram.yml deleted file mode 100644 index 1ab1fb3..0000000 --- a/.gitea/workflows/test-telegram.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Test Telegram Send - -on: - workflow_dispatch: - inputs: - test_message: - description: 'Test message to send' - required: false - default: 'Test message from Gitea Actions' - -jobs: - test-telegram: - runs-on: ubuntu-latest - - steps: - - name: Test Telegram Bot Connection - env: - BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - CHAT_ID_1: ${{ secrets.TELEGRAM_CHAT_ID_1_GROUP }} - run: | - echo "=== Telegram Configuration Check ===" - echo "Bot token configured: $([ -n "$BOT_TOKEN" ] && echo 'YES' || echo 'NO')" - echo "Bot token length: ${#BOT_TOKEN}" - echo "Chat ID configured: $([ -n "$CHAT_ID_1" ] && echo 'YES' || echo 'NO')" - echo "Chat ID value: ${CHAT_ID_1}" - echo "====================================" - - # Test 1: Check if bot token is valid - echo "" - echo "Test 1: Checking bot token validity..." - BOT_INFO=$(curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getMe") - echo "Bot info response: $BOT_INFO" - - if echo "$BOT_INFO" | grep -q '"ok":true'; then - echo "✓ Bot token is valid!" - BOT_USERNAME=$(echo "$BOT_INFO" | grep -o '"username":"[^"]*"' | cut -d'"' -f4) - echo " Bot username: @${BOT_USERNAME}" - else - echo "✗ Bot token is invalid or there's an API issue" - echo " Please check your TELEGRAM_BOT_TOKEN secret" - exit 1 - fi - - # Test 2: Send a simple text message - echo "" - echo "Test 2: Sending text message..." - TEXT_RESPONSE=$(curl -s -w "\nHTTP_CODE:%{http_code}" \ - -d "chat_id=${CHAT_ID_1}" \ - -d "text=${{ github.event.inputs.test_message }}" \ - "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage") - - HTTP_CODE=$(echo "$TEXT_RESPONSE" | grep "HTTP_CODE:" | cut -d: -f2) - RESPONSE_BODY=$(echo "$TEXT_RESPONSE" | sed '/HTTP_CODE:/d') - - echo "HTTP Status: $HTTP_CODE" - echo "Response: $RESPONSE_BODY" - - if [ "$HTTP_CODE" = "200" ]; then - echo "✓ Text message sent successfully!" - else - echo "✗ Failed to send text message" - echo " Common issues:" - echo " - Chat ID is incorrect (should be negative for groups: -1001234567890)" - echo " - Bot is not a member of the group/channel" - echo " - Bot doesn't have permission to send messages" - exit 1 - fi - - # Test 3: Create and send a test file - echo "" - echo "Test 3: Sending test file..." - echo "This is a test file from Gitea Actions" > test_file.txt - - FILE_RESPONSE=$(curl -s -w "\nHTTP_CODE:%{http_code}" \ - -F document=@"test_file.txt" \ - -F caption="Test file upload from Gitea Actions" \ - "https://api.telegram.org/bot${BOT_TOKEN}/sendDocument?chat_id=${CHAT_ID_1}") - - HTTP_CODE=$(echo "$FILE_RESPONSE" | grep "HTTP_CODE:" | cut -d: -f2) - RESPONSE_BODY=$(echo "$FILE_RESPONSE" | sed '/HTTP_CODE:/d') - - echo "HTTP Status: $HTTP_CODE" - echo "Response: $RESPONSE_BODY" - - if [ "$HTTP_CODE" = "200" ]; then - echo "✓ File sent successfully!" - else - echo "✗ Failed to send file" - exit 1 - fi - - echo "" - echo "=== All tests passed! ==="