Skip to content

Commit

Permalink
gha: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
gjpin committed Dec 27, 2024
1 parent a5e0ade commit a362898
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/check-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ jobs:
sed 's/export GPU_PACKAGES="\([^"]*\)"/\1/' | \
tr '\n' ' ')
echo "gpu_packages=$ALL_GPU_PACKAGES" >> $GITHUB_ENV
- name: Extract and validate packages
run: |
set -x # Enable trace mode to debug the script
declare -a failed_packages
# Define known variable expansions using extracted values
Expand All @@ -43,6 +45,9 @@ jobs:
return 0
fi
# Log which package is being validated
echo "Validating package: $package"
if ! pacman -Ss "^${package}$" > /dev/null 2>&1; then
failed_packages+=("$package")
echo "❌ Package not found: $package"
Expand Down Expand Up @@ -106,25 +111,29 @@ jobs:
done
}
# Check if the required files exist before processing
for file in *.sh; do
if [[ -f "$file" ]]; then
echo "📄 Checking packages in $file..."
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" == *"pacman -S --noconfirm"* ]]; then
process_line "$line"
if [[ ! -f "$file" ]]; then
echo "⚠️ $file not found. Skipping."
continue
fi
echo "📄 Checking packages in $file..."
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" == *"pacman -S --noconfirm"* ]]; then
process_line "$line"
if [[ "$line" =~ \\[[:space:]]*$ ]]; then
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ ! "$line" =~ \\[[:space:]]*$ ]] && [[ ! "$line" =~ ^[[:space:]]*[a-zA-Z0-9] ]]; then
break
fi
process_line "$line"
done
fi
if [[ "$line" =~ \\[[:space:]]*$ ]]; then
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ ! "$line" =~ \\[[:space:]]*$ ]] && [[ ! "$line" =~ ^[[:space:]]*[a-zA-Z0-9] ]]; then
break
fi
process_line "$line"
done
fi
done < "$file"
fi
fi
done < "$file"
done
echo "=== Summary ==="
Expand Down

0 comments on commit a362898

Please sign in to comment.