-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'production' into import-figma-icons
- Loading branch information
Showing
3 changed files
with
1,733 additions
and
1,658 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Check icons keywords | ||
|
||
on: | ||
push: | ||
paths: | ||
- "icons/**" | ||
pull_request: | ||
branches: | ||
- production | ||
paths: | ||
- "icons/**" | ||
|
||
jobs: | ||
check_icons: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: List SVG files | ||
run: | | ||
ICONS_DIR="icons" # Reemplaza con la ubicación real de tu carpeta de iconos | ||
echo "Listing SVG files..." | ||
# Utiliza 'find' para encontrar todos los archivos SVG en la carpeta de iconos | ||
find $ICONS_DIR -type f -name "*.svg" | | ||
# Utiliza 'basename' para obtener solo el nombre de archivo sin la ruta | ||
xargs -I {} basename {} | | ||
# Utiliza 'sed' para quitar las partes "-filled", "-light", "-regular" y la extensión ".svg" | ||
sed 's/\(-filled\|-light\|-regular\)\.svg//' | | ||
# Utiliza 'sort -u' para obtener una lista única de nombres de archivo | ||
sort -u > icons.txt | ||
# Muestra el contenido del archivo icons.txt en la consola | ||
cat icons.txt | ||
continue-on-error: false | ||
|
||
- name: Read JSON file | ||
run: | | ||
JSON_FILE="icons/icons-keywords.json" | ||
echo "Reading JSON file..." | ||
cat $JSON_FILE > data.json | ||
continue-on-error: true | ||
|
||
- name: Extract keywords | ||
run: | | ||
echo "Extracting keywords from JSON..." | ||
# Usamos jq para extraer las claves del JSON y guardarlas en keywords.txt | ||
cat data.json | jq -r 'keys[]' > keywords.txt | ||
# Mostramos el contenido de keywords.txt para verificar que se han extraído correctamente | ||
cat keywords.txt | ||
continue-on-error: true | ||
|
||
- name: Compare with Keywords | ||
run: | | ||
echo "Comparing icon names with keywords from JSON..." | ||
for icon_name in $(cat icons.txt); do | ||
if ! grep -q "\"$icon_name\":" data.json; then | ||
echo "Icon name '$icon_name' is missing in the JSON keywords." | ||
exit 1 # Terminar la ejecución con un código de error | ||
fi | ||
done | ||
continue-on-error: false | ||
|
||
- name: Cleanup | ||
run: | | ||
rm data.json | ||
rm icons.txt | ||
rm keywords.txt | ||
continue-on-error: true |
Oops, something went wrong.