Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for duplicate keys in Java properties files, fix CodeMeta displayName #9176

Merged
merged 16 commits into from
Aug 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ci: add workflow to check for duplicate keys in Java properties files #…
  • Loading branch information
poikilotherm committed Jul 2, 2024
commit 3806b9c3225e647bbc5035b4f7a552edb3633223
34 changes: 34 additions & 0 deletions .github/workflows/check_property_files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Properties Check"
on:
pull_request:
#paths:
# - "**/*.properties"
jobs:
duplicate_keys:
name: Duplicate Keys
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run duplicates detection script
shell: bash
run: |
FAIL=0

for PF in $(find . -wholename '*/src/*.properties'); do
FILTER=$(grep -a -v -E "^(#.*|\s*$)" "$PF" | cut -d"=" -f1 | sort | uniq -c | tr -s " " | { grep -vs "^ 1 " || true; })
if [ -n "$FILTER" ]; then
FAIL=1

echo "::group::$PF"
for KEY in $(echo "$FILTER" | cut -d" " -f3); do
for LINE in $(grep -n -E -e "^$KEY=" "$PF" | cut -d":" -f1); do
echo "::error file=$PF,line=$LINE::Found duplicate for key '$KEY' in line $LINE"
done
done
echo "::endgroup::"
fi
done

if [ "$FAIL" -eq 1 ]; then
exit 1
fi