Update .gitea/workflows/update-dispatches.yaml
Some checks failed
Update Dispatches / refresh-news (push) Failing after 1s

This commit is contained in:
2026-02-06 05:52:39 -05:00
parent 3a79bb3027
commit daebb5b2d2

View File

@@ -8,34 +8,32 @@ jobs:
- name: Local Disk Checkout
shell: bash
run: |
# Clean the workspace
rm -rf ./*
# Use the verified lowercase local path
git clone --depth 50 file:///var/lib/gitea/data/gitea-repositories/dynr/dynastyrevolution-scripts.git .
- name: Generate News Scroll
shell: bash
run: |
# Create the news file from the last 3 commits
git log -3 --pretty=format:"Published: %ad | %s (%an)" --date=format:"%m-%d-%Y" > dispatches.txt
echo "--- Generated Dispatches ---"
cat dispatches.txt
- name: Commit and Push to Disk
shell: bash
run: |
# Configure local git identity
# 1. Setup local git identity
git config --local user.email "action@dynastyrevolution.com"
git config --local user.name "Dynasty Bot"
# Add and commit the file
git add dispatches.txt
git commit -m "chore: Update Archive Dispatches [skip ci]" || echo "No changes to commit"
# FIX: Transfer ownership of the workspace to 'gitea' so the push can succeed.
# This prevents the "dubious ownership" and "root cache" errors.
chown -R gitea:gitea .
# FIX: Push as the 'gitea' user to satisfy Gitea's "No Root" security hooks.
# We use 'sudo -H' to ensure it uses gitea's home directory instead of /root.
sudo -H -u gitea git push origin main
git commit -m "chore: Update Archive Dispatches [skip ci]" || echo "No changes"
# 2. Move the whole workspace to /tmp (Neutral Ground)
# This bypasses the restricted /root/ directory entirely.
TEMP_DIR="/tmp/dynasty_sync_$(date +%s)"
cp -r . "$TEMP_DIR"
chown -R gitea:gitea "$TEMP_DIR"
# 3. Push from the neutral location as the gitea user
cd "$TEMP_DIR"
sudo -u gitea git push origin main
# 4. Cleanup
rm -rf "$TEMP_DIR"