Skip to content

Commit 1faa204

Browse files
committed
fix: enhance secret handling in test.yml; generate random secret if not provided
1 parent 57c7f62 commit 1faa204

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ jobs:
1414

1515
- name: Build and Run Tests
1616
env:
17-
# Generate a random secret for testing
17+
# Use secret if available, otherwise will be generated in run step
1818
MTPROXY_SECRET: ${{ secrets.MTPROXY_SECRET }}
1919
# Optional: Set dummy API credentials or use secrets if available
2020
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID || '12345' }}
2121
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH || 'dummy_hash' }}
2222
run: |
23+
if [ -z "$MTPROXY_SECRET" ]; then
24+
export MTPROXY_SECRET=$(hexdump -n 16 -e '4/4 "%08x" 1 "\n"' /dev/urandom)
25+
echo "Generated random MTPROXY_SECRET for testing"
26+
fi
27+
2328
# Run tests passing env vars
2429
make test
2530
@@ -65,7 +70,9 @@ jobs:
6570
- name: Run Python Tests
6671
env:
6772
# Session path null for CI
68-
TEST_SESSION_PATH: /dev/null
73+
TEST_SESSION_PATH: /dev/null
74+
TELEGRAM_API_ID: ${{ secrets.TELEGRAM_API_ID }}
75+
TELEGRAM_API_HASH: ${{ secrets.TELEGRAM_API_HASH }}
6976
run: |
7077
# We need to tell the test script to connect to localhost since we are not in docker-compose
7178
# We can do this by setting an env var or modifying the script to fallback to localhost

0 commit comments

Comments
 (0)