-
Notifications
You must be signed in to change notification settings - Fork 17
34 lines (32 loc) · 1.13 KB
/
count_components.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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