ci: add file-checker.yml
(#119)
We want to enforce the existence of the files contained within the userstyles template directory. This will eliminate PRs getting merged that may have deleted existing files or may have missing preview images.
This commit is contained in:
parent
cad7ab79b0
commit
2437199673
49
.github/workflows/file-checker.yml
vendored
Normal file
49
.github/workflows/file-checker.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
name: Required Files Checker
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request_target:
|
||||
|
||||
jobs:
|
||||
file-checker:
|
||||
name: Check for Missing Files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check
|
||||
run: |
|
||||
MISSING_FILES=0
|
||||
echo "# Missing Files Found 😠" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
required_files=(
|
||||
"catppuccin.user.css"
|
||||
"assets/mocha.webp"
|
||||
"assets/macchiato.webp"
|
||||
"assets/frappe.webp"
|
||||
"assets/latte.webp"
|
||||
"assets/catwalk.webp"
|
||||
)
|
||||
|
||||
find_files() {
|
||||
local path=$1
|
||||
for file in "${required_files[@]}"; do
|
||||
if [ ! -f "$path/$file" ]; then
|
||||
MISSING_FILES=1
|
||||
echo "- $path/$file" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
for dir in styles/*; do
|
||||
if [ -d "$dir" ]; then
|
||||
find_files "$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $MISSING_FILES -eq 0 ]; then
|
||||
echo "# No Missing Files 🙌" > $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
exit $MISSING_FILES
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
Loading…
x
Reference in New Issue
Block a user