Merge branch 'main' of https://github.com/Ritika-Agrawal811/css-and-j… #21
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: 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: Update README | |
run: | | |
echo "## ${{ env.components }} Components" > temp_readme.md | |
cat README.md >> temp_readme.md | |
mv temp_readme.md README.md | |
git add README.md | |
git commit -m "Update number of components in README" || echo "No changes to commit" | |
git push |