This commit is contained in:
Hadi
2025-03-27 10:18:09 +01:00
commit f1b7324fb2
390 changed files with 11178 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
name: Check Wallpapers Format
on:
push:
paths:
- 'wallpapers/**'
pull_request:
paths:
- 'wallpapers/**'
jobs:
check-extensions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate file format and naming conventions
run: |
# Loop through all wallpaper files
cd "./wallpapers"
for file in *; do
if [[ -f "$file" ]]; then
filename=$file
basename=$(echo "$file" | cut -d. -f1)
# Check if .png, .jpg or .gif
if [[ ! $filename =~ \.(png|jpg|gif)$ ]]; then
echo "❌ Error: $file is not a PNG, JPG or GIF file"
exit 1
fi
# Check if only lowercase letters, - and _ are used
echo "$basename" | grep -qE '^[a-z0-9][a-z0-9_-]*$' || {
echo "❌ Error: $file contains invalid characters"
exit 1
}
if [[ $basename == *-_* ]]; then
echo "❌ Error: $file contains a tag with a leading or trailing _"
exit 1
fi
if [[ $basename == *"_static"* ]]; then
if [ ! -f "${basename}*.gif" ]; then
echo "❌ Error: $file has a static tag but no gif file"
exit 1
fi
fi
if [[ $basename == *"_animated"* ]]; then
if [ ! -f "${basename}*.png" ] && [ ! -f "${basename}*.jpg" ]; then
echo "❌ Error: $file has a animated tag but no png or jpg file"
exit 1
fi
fi
if [[ $filename == *.gif && $basename != *"_animated"* ]]; then
echo "❌ Error: $file is a gif file but doesn't contain _static or _animated"
exit 1
fi
fi
done
@@ -0,0 +1,49 @@
name: Create Wallpapers Markdown
on:
workflow_run:
workflows: ["Check Wallpapers Format"]
types:
- completed
permissions:
contents: write
jobs:
generate-md:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }} # Only run if the first workflow was successful
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create WALLPAPERS.md
run: |
# Set the output file
OUTPUT_FILE="WALLPAPERS.md"
# Start the markdown file content
echo "# Wallpapers" > $OUTPUT_FILE
echo "" >> $OUTPUT_FILE
# Create a table with 2 columns for the wallpapers and their names
echo "| Wallpaper | Name |" >> $OUTPUT_FILE
echo "|-----------|------|" >> $OUTPUT_FILE
# Loop through the wallpapers directory
for file in wallpapers/*.{png,jpg,gif}; do
if [[ -f "$file" ]]; then
# Get the filename without the path
FILENAME=$(basename "$file")
# Get the name of the wallpaper (without extension)
NAME="${FILENAME%.*}"
# Create the markdown table entry for the wallpaper
echo "| ![${NAME}](${file}) | ${NAME} |" >> $OUTPUT_FILE
fi
done
# Commit the changes
git config user.name github-actions
git config user.email [email protected]
git add $OUTPUT_FILE
git commit -m "Generate WALLPAPERS.md" && git push
exit 0