mirror of
https://github.com/Nezumi-2711/revanced-apk-build.git
synced 2026-09-22 13:38:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
788b36f083 | ||
|
|
ae43197aa0 | ||
|
|
c2fe93675e | ||
|
|
aee01f1ca5 | ||
|
|
679631315e | ||
|
|
a2ca664121 |
@@ -145,3 +145,64 @@ jobs:
|
|||||||
MSG=${MSG:0:9450}
|
MSG=${MSG:0:9450}
|
||||||
POST="https://api.telegram.org/bot${TG_TOKEN}/sendMessage"
|
POST="https://api.telegram.org/bot${TG_TOKEN}/sendMessage"
|
||||||
curl -X POST --data-urlencode "parse_mode=Markdown" --data-urlencode "disable_web_page_preview=true" --data-urlencode "text=${MSG}" --data-urlencode "chat_id=${TG_CHAT}" "$POST"
|
curl -X POST --data-urlencode "parse_mode=Markdown" --data-urlencode "disable_web_page_preview=true" --data-urlencode "text=${MSG}" --data-urlencode "chat_id=${TG_CHAT}" "$POST"
|
||||||
|
|
||||||
|
- name: Report to Discord
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
if: env.DISCORD_WEBHOOK_URL != null
|
||||||
|
run: |
|
||||||
|
cd build || { echo "build folder not found"; exit 1; }
|
||||||
|
|
||||||
|
NL=$'\n'
|
||||||
|
APKS=""
|
||||||
|
MODULES=""
|
||||||
|
for OUTPUT in *; do
|
||||||
|
DL_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/download/${{ steps.next_ver_code.outputs.NEXT_VER_CODE }}/${OUTPUT}"
|
||||||
|
if [[ $OUTPUT = *.apk ]]; then
|
||||||
|
APKS+="${NL}- [${OUTPUT}](${DL_URL})"
|
||||||
|
elif [[ $OUTPUT = *.zip ]]; then
|
||||||
|
MODULES+="${NL}- [${OUTPUT}](${DL_URL})"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
MODULES=${MODULES#"$NL"}
|
||||||
|
APKS=${APKS#"$NL"}
|
||||||
|
|
||||||
|
BODY="$(sed 's/^\* \*\*/- \*\*/g; s/^\* `/- \*\*/g; s/`/\*/g; s/^\* /\-/g; s/\*\*/\*/g; s/###//g; s/^- /- /g; /^==/d;' ../build.md)"
|
||||||
|
MSG="**New build is ready!**
|
||||||
|
|
||||||
|
${BODY}
|
||||||
|
|
||||||
|
**Download Links:**
|
||||||
|
**Modules:**
|
||||||
|
${MODULES}
|
||||||
|
|
||||||
|
**APKs:**
|
||||||
|
${APKS}
|
||||||
|
"
|
||||||
|
|
||||||
|
# Function to split messages properly by ensuring correct Markdown formatting
|
||||||
|
send_discord_message() {
|
||||||
|
local message="$1"
|
||||||
|
local chunk=""
|
||||||
|
local remainder="$message"
|
||||||
|
|
||||||
|
while [ ${#remainder} -gt 0 ]; do
|
||||||
|
# Try to split at the last newline within the 2000-character limit
|
||||||
|
chunk="${remainder:0:2000}"
|
||||||
|
local cutoff=$(echo "$chunk" | awk 'END {print length($0) - length($NF)}') # Find last space/newline
|
||||||
|
if [ "$cutoff" -lt 2000 ]; then
|
||||||
|
chunk="${remainder:0:$cutoff}" # Safe chunk
|
||||||
|
remainder="${remainder:$cutoff}" # Remaining text
|
||||||
|
else
|
||||||
|
remainder="${remainder:2000}" # Fallback to default split
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Send the chunk to Discord
|
||||||
|
curl -X POST -H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg content "$chunk" '{content: $content}')" \
|
||||||
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
send_discord_message "$MSG"
|
||||||
|
|||||||
@@ -46,5 +46,5 @@ jobs:
|
|||||||
permissions: write-all
|
permissions: write-all
|
||||||
needs: check
|
needs: check
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
if: ${{ needs.check.outputs.SHOULD_BUILD == 1 }}
|
if: ${{ needs.check.outputs.SHOULD_BUILD == 0 }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|||||||
Reference in New Issue
Block a user