mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-09 01:09:16 +00:00
Create check-metadata.yml
This commit is contained in:
parent
2832a1e2c4
commit
78e26d84f6
51
.github/workflows/check-metadata.yml
vendored
Normal file
51
.github/workflows/check-metadata.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
name: Check Metadata
|
||||||
|
'on':
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**/*.sh'
|
||||||
|
jobs:
|
||||||
|
check-metadata:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Check `source` Line in Scripts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
ERROR_COUNT=0
|
||||||
|
FILES=$(find . -name "*.sh")
|
||||||
|
|
||||||
|
for FILE in $FILES; do
|
||||||
|
if grep -qF "# Copyright (c) 2021-2024 community-scripts ORG" "$FILE"; then
|
||||||
|
echo "Check for Copyright metadata passed for: $FILE"
|
||||||
|
else
|
||||||
|
echo "Error in $FILE: Copyright metadata missing"
|
||||||
|
ERROR_COUNT=$((ERROR_COUNT + 1))
|
||||||
|
fi
|
||||||
|
if grep -qF "# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE" "$FILE"; then
|
||||||
|
echo "Check for License metadata passed for: $FILE"
|
||||||
|
else
|
||||||
|
echo "Error in $FILE: License metadata missing"
|
||||||
|
ERROR_COUNT=$((ERROR_COUNT + 1))
|
||||||
|
fi
|
||||||
|
if grep -q "^# Source: .\+" "$FILE"; then
|
||||||
|
echo "Check for Source metadata passed for: $FILE"
|
||||||
|
else
|
||||||
|
echo "Error in $FILE: Source metadata missing"
|
||||||
|
ERROR_COUNT=$((ERROR_COUNT + 1))
|
||||||
|
fi
|
||||||
|
if grep -q "^# Source: .\+" "$FILE"; then
|
||||||
|
echo "Check for Author metadata passed for: $FILE"
|
||||||
|
else
|
||||||
|
echo "Error in $FILE: Author metadata missing"
|
||||||
|
ERROR_COUNT=$((ERROR_COUNT + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$ERROR_COUNT" -gt 0 ]]; then
|
||||||
|
echo "$ERROR_COUNT script(s) failed validation."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "All scripts passed."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user