Skip to content

Add files via upload #103

Add files via upload

Add files via upload #103

Workflow file for this run

name: Count Files
on:
push:
branches:
- main
paths:
- 'All Certs Uncategorized/**'
workflow_dispatch:
jobs:
count-files:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Count files in folder
id: count
run: |
FOLDER='All Certs Uncategorized'
FILE_COUNT=$(find "$FOLDER" -type f | wc -l)
echo "file_count=$FILE_COUNT" >> $GITHUB_ENV
- name: Create badge data
run: |
LABEL='TotalCountofSoftwareCertificates'
BADGE_URL="https://img.shields.io/badge/${LABEL}-${{env.file_count}}-green"
echo "Dynamic Badge URL: $BADGE_URL"
sed -i "s|!\\[TotalCountofSoftwareCertificates\\](.*)|!\\[TotalCountofSoftwareCertificates\\](${BADGE_URL})|" README.md
- name: Commit badge data
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add -f README.md
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "Update file count badge to readme"
git push
fi