name: Email Notification Test on: workflow_dispatch: inputs: recipient_email: description: 'Email address to send test to (leave empty to use MAIL_TO secret)' required: false type: string jobs: send-test-email: runs-on: ubuntu-latest steps: - name: Send Test Email (Resend) env: RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }} MAIL_TO: ${{ inputs.recipient_email || secrets.MAIL_TO }} MAIL_CC: ${{ secrets.MAIL_CC }} MAIL_BCC: ${{ secrets.MAIL_BCC }} MAIL_FROM: ${{ secrets.MAIL_FROM }} run: | if [ -z "$RESEND_API_KEY" ]; then echo "โŒ Error: RESEND_API_KEY secret is not set!" exit 1 fi if [ -z "$MAIL_TO" ]; then echo "โŒ Error: No email recipient specified!" echo "Either provide recipient_email input or set MAIL_TO secret." exit 1 fi # Set default FROM address if not provided FROM_ADDRESS="${MAIL_FROM:-ReVanced Build Bot }" # Use Vietnam timezone (UTC+7) VERSION="TEST-$(TZ='Asia/Ho_Chi_Minh' date +%Y%m%d-%H%M%S)" SENT_TIME=$(TZ='Asia/Ho_Chi_Minh' date '+%Y-%m-%d %H:%M:%S (UTC+7)') RELEASE_URL="${{ github.server_url }}/${{ github.repository }}/releases" REPO="${{ github.repository }}" # Create test HTML email body HTML_BODY=$(cat <

๐Ÿงช Test Email

Version: ${VERSION}

โœ… Email Configuration Working!

If you received this email, it means your Resend configuration is working correctly!

๐Ÿ“‹ Configuration Details

  • ๐Ÿ“ง From: ${FROM_ADDRESS}
  • ๐Ÿ“ฌ To: ${MAIL_TO}
  • ๐Ÿ• Sent at: ${SENT_TIME}
View Releases

This is a TEST email from ReVanced Build Bot

Repository: ${REPO}

EOF ) # Build JSON payload JSON_PAYLOAD=$(jq -n \ --arg from "$FROM_ADDRESS" \ --arg to "$MAIL_TO" \ --arg cc "$MAIL_CC" \ --arg bcc "$MAIL_BCC" \ --arg subject "๐Ÿงช [TEST] ReVanced Build Email - ${VERSION}" \ --arg html "$HTML_BODY" \ '{ from: $from, to: ($to | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; ""))), subject: $subject, html: $html } + (if $cc != "" then {cc: ($cc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end) + (if $bcc != "" then {bcc: ($bcc | split(",") | map(select(. != "") | gsub("^\\s+|\\s+$"; "")))} else {} end)' ) echo "๐Ÿ“ง Sending test email to: $MAIL_TO" if [ -n "$MAIL_CC" ]; then echo "๐Ÿ“‹ CC: $MAIL_CC"; fi if [ -n "$MAIL_BCC" ]; then echo "๐Ÿ”’ BCC: $MAIL_BCC"; fi echo "" # Send email via Resend API RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "https://api.resend.com/emails" \ -H "Authorization: Bearer ${RESEND_API_KEY}" \ -H "Content-Type: application/json" \ -d "$JSON_PAYLOAD") HTTP_CODE=$(echo "$RESPONSE" | tail -n1) BODY=$(echo "$RESPONSE" | sed '$d') echo "Response: $BODY" echo "HTTP Code: $HTTP_CODE" if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then echo "" echo "โœ… Test email sent successfully!" echo "๐Ÿ“ฌ Check your inbox at: $MAIL_TO" else echo "" echo "โŒ Failed to send email!" echo "Please check your RESEND_API_KEY and email addresses." exit 1 fi