Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/update_scribe_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,20 @@ jobs:
{
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"body": "$TITLE - Data updated on Toolforge.",
"body": "$TITLE - Data updated on Toolforge",
"formatted_body": "<h4>$TITLE</h4><ul><li><strong>Languages processed:</strong> $LANG_COUNT ($LANG_LIST_FORMATTED)</li><li><strong>Data types processed:</strong> $TYPES_COUNT ($TYPES_LIST_FORMATTED)</li><li><strong>Data Generation:</strong> Completed</li><li><strong>SQLite Conversion:</strong> Completed</li><li><strong>Files Copied:</strong> $SQLITE_COUNT files to the server</li></ul><p>🎉 Data fetched from Scribe-Data has been updated on Toolforge and migrated to MariaDB!</p><p><a href='$RUN_URL'>View Full Log</a></p>"
}
EOF
)

curl -v --fail --show-error -X POST "${{ secrets.MATRIX_HOMESERVER }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_DATA_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_SCRIBE_BOT_ACCESS_TOKEN }}" \
# Generate a unique transaction ID
TXN_ID=$(date +%s%N)

# URL-encode the room ID to handle special characters safely
ROOM_ID=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${{ secrets.MATRIX_DATA_ROOM_ID }}'))")

curl -v --fail --show-error -X PUT "${{ secrets.MATRIX_HOMESERVER }}/_matrix/client/v3/rooms/${ROOM_ID}/send/m.room.message/${TXN_ID}" \
-H "Authorization: Bearer ${{ secrets.MATRIX_SCRIBE_BOT_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD"

Expand All @@ -216,7 +223,13 @@ jobs:
echo "❌ Deployment failed. Check the logs above for details."
TITLE="❌ Toolforge Server Update Failed"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl -X POST "${{ secrets.MATRIX_HOMESERVER }}/_matrix/client/r0/rooms/${{ secrets.MATRIX_DATA_ROOM_ID }}/send/m.room.message?access_token=${{ secrets.MATRIX_SCRIBE_BOT_ACCESS_TOKEN }}" \

# Generate a unique transaction ID and URL-encode the room ID
TXN_ID=$(date +%s%N)
ROOM_ID=$(python3 -c "import urllib.parse; print(urllib.parse.quote('${{ secrets.MATRIX_DATA_ROOM_ID }}'))")

curl -X PUT "${{ secrets.MATRIX_HOMESERVER }}/_matrix/client/v3/rooms/${ROOM_ID}/send/m.room.message/${TXN_ID}" \
-H "Authorization: Bearer ${{ secrets.MATRIX_SCRIBE_BOT_ACCESS_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{
\"msgtype\": \"m.text\",
Expand Down