fixing workflow

This commit is contained in:
2026-03-11 15:03:27 +00:00
parent fe8afcecc4
commit bd7086d1df

View File

@@ -9,39 +9,45 @@ on:
jobs: jobs:
update-db: update-db:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container: archlinux:latest
image: archlinux:latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # Fetches all history so push works better fetch-depth: 0
- name: Install Dependencies - name: Install Dependencies
run: | run: |
pacman -Sy --noconfirm pacman git # Added 'git' here pacman -Sy --noconfirm pacman git
- name: Update Repository Database - name: Update Repository Database
run: | run: |
cd x86_64 cd x86_64
# Update the database # Check if any .zst files exist before running repo-add
repo-add hyprarch-repo.db.tar.gz *.pkg.tar.zst if ls *.pkg.tar.zst 1> /dev/null 2>&1; then
echo "Packages found. Updating database..."
# Force break symlinks for GitHub Pages compatibility repo-add hyprarch-repo.db.tar.gz *.pkg.tar.zst
rm -f hyprarch-repo.db hyprarch-repo.files
cp hyprarch-repo.db.tar.gz hyprarch-repo.db # Fix symlinks for GitHub Pages
cp hyprarch-repo.files.tar.gz hyprarch-repo.files rm -f hyprarch-repo.db hyprarch-repo.files
cp hyprarch-repo.db.tar.gz hyprarch-repo.db
cp hyprarch-repo.files.tar.gz hyprarch-repo.files
else
echo "No .pkg.tar.zst files found. Skipping database update."
fi
- name: Commit and Push changes - name: Commit and Push changes
run: | run: |
# This line fixes the 'dubious ownership' error in containers
git config --global --add safe.directory "$GITHUB_WORKSPACE" git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global user.name "github-actions[bot]" git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add x86_64/ git add x86_64/
# Only commit if there are actually changes to the .db files # Only push if there's actually a new database to upload
git diff-index --quiet HEAD || git commit -m "Automated database update" if ! git diff-index --quiet HEAD; then
git push git commit -m "Automated database update"
git push
else
echo "Nothing to commit."
fi