Skip to content

Verify packages

Verify packages #3

name: Verify Arch Linux Packages
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allows manual triggering
jobs:
check-packages:
runs-on: ubuntu-latest
container:
image: archlinux:latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Update Pacman and Install Base Packages
run: |
# Update pacman database and install essential tools
pacman -Syu --noconfirm
pacman -S --noconfirm grep sed coreutils
- name: Check Packages
run: |
# Flag to track errors
error_flag=0
# Find all packages mentioned in .sh files
grep -rhEo "pacman -S --noconfirm[[:space:]]+.*" . | \
sed -E 's/pacman -S --noconfirm[[:space:]]+//' | \
tr '\\' '\n' | tr -s ' ' '\n' | sort -u | while read -r package; do
if [[ -n "$package" ]]; then
echo "Checking package: $package"
if ! pacman -Si "$package" &>/dev/null; then
echo "::error::Package '$package' does not exist in the Arch Linux repositories."
error_flag=1
else
echo "Package '$package' exists."
fi
fi
done
# Fail the workflow if any package is missing
if [[ $error_flag -ne 0 ]]; then
echo "One or more packages do not exist. Failing the workflow."
exit 1
fi