Skip to content

feat: add components count label" #28

feat: add components count label"

feat: add components count label" #28

name: Count the components
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
count_components:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Count Components
run: |
#!/bin/bash
# Count components in the repository
components=$(find . -mindepth 2 -maxdepth 2 -type d -name '[A-Z]*' ! -path '*/.*' -exec sh -c 'dirname="{}"; parent_dir=$(basename "$(dirname "$dirname")"); echo "$parent_dir" | grep -q "^[A-Z]" && echo "{}"' \; | wc -l)
echo "components=$components" >> $GITHUB_ENV
- name: Set Git user identity
run: |
git config --global user.email "ritikaagrawal339@gmail.com"
git config --global user.name "Ritika Agrawal"
- name: Add Components Count SVG
run: |
echo '<svg xmlns="http://www.w3.org/2000/svg" width="150" height="35">
<link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-custom-link"/>
<link xmlns="" type="text/css" rel="stylesheet" id="dark-mode-general-link"/>
<style xmlns="" lang="en" type="text/css" id="dark-mode-custom-style"/>
<style xmlns="" lang="en" type="text/css" id="dark-mode-native-style"/>
<style xmlns="" lang="en" type="text/css" id="dark-mode-native-sheet"/>
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<mask id="a">
<rect width="150" height="35" rx="3" fill="#fff"/>
</mask>
<g mask="url(#a)">
<rect width="110" height="35" fill="#555"/>
<rect x="110" width="60" height="35" fill="#2a17d1"/>
<rect width="150" height="35" fill="url(#b)"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="13">
<text x="60" y="22" fill="#010101" fill-opacity=".3">Components</text>
<text x="60" y="22">Components</text>
<text x="130" y="22" fill="#010101" fill-opacity=".3">${{ env.components }}</text>
<text x="130" y="22">${{ env.components }}</text>
</g>
</svg>' > component_count.svg
git add component_count.svg
git commit -m "Create a components count svg" || echo "No changes to commit"
git push