mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-12 15:50:19 -08:00
f
This commit is contained in:
30
.github/workflows/build_master.yml
vendored
30
.github/workflows/build_master.yml
vendored
@@ -71,13 +71,37 @@ jobs:
|
|||||||
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
|
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
|
||||||
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
|
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
|
||||||
|
|
||||||
# Commit and push
|
# Commit and push with retry logic
|
||||||
cd /tmp/searchindex-repo
|
cd /tmp/searchindex-repo
|
||||||
git config user.name "GitHub Actions"
|
git config user.name "GitHub Actions"
|
||||||
git config user.email "github-actions@github.com"
|
git config user.email "github-actions@github.com"
|
||||||
git add "${FILENAME}" "${FILENAME}.gz"
|
git add "${FILENAME}" "${FILENAME}.gz"
|
||||||
git commit -m "Update ${FILENAME} from hacktricks-cloud build" || echo "No changes to commit"
|
|
||||||
git push || echo "No changes to push"
|
if git diff --staged --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "Update ${FILENAME} from hacktricks-cloud build"
|
||||||
|
|
||||||
|
# Retry push up to 20 times with pull --rebase between attempts
|
||||||
|
MAX_RETRIES=20
|
||||||
|
RETRY_COUNT=0
|
||||||
|
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
|
||||||
|
if git push origin main; then
|
||||||
|
echo "Successfully pushed on attempt $((RETRY_COUNT + 1))"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||||
|
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
|
||||||
|
echo "Push failed, attempt $RETRY_COUNT/$MAX_RETRIES. Pulling and retrying..."
|
||||||
|
git pull --rebase origin main
|
||||||
|
sleep $((RETRY_COUNT * 2)) # Exponential backoff
|
||||||
|
else
|
||||||
|
echo "Failed to push after $MAX_RETRIES attempts"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Login in AWs
|
# Login in AWs
|
||||||
- name: Configure AWS credentials using OIDC
|
- name: Configure AWS credentials using OIDC
|
||||||
|
|||||||
30
.github/workflows/translate_all.yml
vendored
30
.github/workflows/translate_all.yml
vendored
@@ -180,13 +180,37 @@ jobs:
|
|||||||
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
|
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
|
||||||
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
|
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
|
||||||
|
|
||||||
# Commit and push
|
# Commit and push with retry logic
|
||||||
cd /tmp/searchindex-repo
|
cd /tmp/searchindex-repo
|
||||||
git config user.name "GitHub Actions"
|
git config user.name "GitHub Actions"
|
||||||
git config user.email "github-actions@github.com"
|
git config user.email "github-actions@github.com"
|
||||||
git add "${FILENAME}" "${FILENAME}.gz"
|
git add "${FILENAME}" "${FILENAME}.gz"
|
||||||
git commit -m "Update ${FILENAME} from hacktricks-cloud build" || echo "No changes to commit"
|
|
||||||
git push || echo "No changes to push"
|
if git diff --staged --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "Update ${FILENAME} from hacktricks-cloud build"
|
||||||
|
|
||||||
|
# Retry push up to 20 times with pull --rebase between attempts
|
||||||
|
MAX_RETRIES=20
|
||||||
|
RETRY_COUNT=0
|
||||||
|
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
|
||||||
|
if git push origin main; then
|
||||||
|
echo "Successfully pushed on attempt $((RETRY_COUNT + 1))"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||||
|
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
|
||||||
|
echo "Push failed, attempt $RETRY_COUNT/$MAX_RETRIES. Pulling and retrying..."
|
||||||
|
git pull --rebase origin main
|
||||||
|
sleep $((RETRY_COUNT * 2)) # Exponential backoff
|
||||||
|
else
|
||||||
|
echo "Failed to push after $MAX_RETRIES attempts"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Login in AWs
|
# Login in AWs
|
||||||
- name: Configure AWS credentials using OIDC
|
- name: Configure AWS credentials using OIDC
|
||||||
|
|||||||
Reference in New Issue
Block a user