Optimize git operations: Add timeout, improve config, use shallow clone

This commit is contained in:
2025-11-20 01:45:30 +01:00
parent 1c301936f7
commit 12626949fe

View File

@@ -16,11 +16,15 @@ jobs:
git config --global user.name 'LawGit Bot'
git config --global user.email 'bot@git.coded.law'
git config --global init.defaultBranch main
git config --global http.postBuffer 524288000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 0
- name: Checkout repository
run: |
git clone https://git.coded.law/${{ github.repository }}.git .
git clone --depth=1 https://git.coded.law/${{ github.repository }}.git .
git remote set-url origin https://git.coded.law/${{ github.repository }}.git
git fetch --unshallow || true
- name: Set up Python
run: |
@@ -82,7 +86,8 @@ jobs:
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b $BRANCH_NAME
git commit -m "Update laws from RSS - $(date +'%Y-%m-%d %H:%M:%S UTC')" || exit 0
git push origin $BRANCH_NAME || echo "Push fehlgeschlagen"
# Push with timeout (10 minutes max) and progress output
timeout 600 git push --progress origin $BRANCH_NAME 2>&1 || echo "Push fehlgeschlagen oder Timeout"
- name: Create Pull Request
if: steps.check_changes.outputs.changed == 'true'