Added README-SQ translated in Albanian #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check README Suffixes | |
on: | |
pull_request: | |
paths: | |
- 'README-*' | |
jobs: | |
check-readme-suffixes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.0 | |
- name: Install dependencies | |
run: | | |
gem install nokogiri | |
- name: Check README suffixes | |
run: | | |
# Scrape ISO 639 language codes from the Wiki page | |
wget -qO- https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes | \ | |
nokogiri -e 'puts $_.css(".wikitable td:nth-child(2)").map(&:text)' | \ | |
sed -nr '/^.{0,2}$/p' | # Grab only two letter values | |
tr '[:lower:]' '[:upper:]' > iso639.txt # Covert letters to uppercase | |
# Get list of README file names | |
readme_suffixes=$(ls README-* | sed 's/README-//g; s/.md//g') | |
# Check if README suffixes are valid ISO 639 language codes | |
for suffix in $readme_suffixes; do | |
if ! grep -qw "$suffix" iso639.txt; then | |
echo "Error: Invalid README suffix found: $suffix" | |
exit 1 | |
fi | |
done | |
echo "All README suffixes are valid ISO 639 language codes." | |
# Add more steps for your existing workflow, e.g., running tests or other checks |