Skip to content

Commit

Permalink
Add CI job to check Play Store character count limit requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
opatry committed Oct 16, 2024
1 parent 6d4aae4 commit c543de3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/check-playstore-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 🔢 Check Play Store requirements

on:
push:
branches:
- main
paths:
- 'fastlane/metadata'

jobs:
check:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: ✅ Check character limits
run: ./_ci/check_playstore_requirements.sh
52 changes: 52 additions & 0 deletions _ci/check_playstore_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

set -euo pipefail

origin=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) || exit

# shellcheck disable=SC1091
. "${origin}/utils.sh"

langs=("en-US" "fr-FR")

# Play Store requirements: https://support.google.com/googleplay/android-developer/answer/113469?hl=en#details
app_name_char_count_limit=30
short_description_char_count_limit=80
full_description_char_count_limit=4000
changelog_char_count_limit=500

error_count=0

step "Google Play Store check"

for lang in "${langs[@]}"; do
lang_dir="${origin}/../fastlane/metadata/store/${lang}"

info "Processing store metadata for ${BLUE}${lang}${RESET}"
for filepath in "title.txt" "short_description.txt" "full_description.txt" "changelogs/default.txt"; do
file="${lang_dir}/${filepath}"
filename="$(basename "${file}" .txt)"
case "${filename}" in
title) limit=${app_name_char_count_limit};;
short_description) limit=${short_description_char_count_limit};;
full_description) limit=${full_description_char_count_limit};;
default) limit=${changelog_char_count_limit};;
esac

grep -q '[[:blank:]]$' "${file}" && warn "${YELLOW}${filepath}${RESET} has trailing spaces"

char_count=$(wc -m < "${file}" | awk '{print $1}')
if [ "${char_count}" -gt "${limit}" ]; then
error "${YELLOW}${filepath}${RESET} is too long (${RED_BOLD}${char_count}${RESET} vs ${GREEN}${limit}${RESET})"
((error_count+=1))
fi
done
done

if [ ${error_count} -eq 0 ]; then
step_done
exit 0
else
error "You have ${error_count} errors to fix"
exit ${error_count}
fi

0 comments on commit c543de3

Please sign in to comment.