Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/use-visitor-counter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Use Visitor Counter Logic

on:
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
workflow_dispatch: # Allows manual triggering

permissions:
contents: write
pull-requests: write

jobs:
update-visitor-count:
runs-on: ubuntu-latest

steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Shallow clone visitor counter logic
run: git clone --depth=1 https://github.com/brown9804/github-visitor-counter.git

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies for github-visitor-counter
run: |
cd github-visitor-counter
npm ci

- name: Run visitor counter logic (updates markdown badges and metrics.json)
run: node github-visitor-counter/update_repo_views_counter.js
env:
TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
REPO: ${{ github.repository }}

- name: Move generated metrics.json to root
run: mv github-visitor-counter/metrics.json .

- name: List files for debugging
run: |
ls -l
ls -l github-visitor-counter

- name: Clean up visitor counter logic
run: rm -rf github-visitor-counter

- name: Configure Git author
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

# Commit and push logic for PR events (merge, not rebase)
- name: Commit and push changes (PR)
if: github.event_name == 'pull_request'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch origin
git checkout ${{ github.head_ref }}
git pull origin ${{ github.head_ref }} || echo "No merge needed"
git add -A
git commit -m "Update visitor count" || echo "No changes to commit"
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
git push origin HEAD:${{ github.head_ref }}

# Commit and push logic for non-PR events (merge, not rebase)
- name: Commit and push changes (non-PR)
if: github.event_name != 'pull_request'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch origin
git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }}
git pull origin ${{ github.ref_name }} || echo "No merge needed"
git add -A
git commit -m "Update visitor count" || echo "No changes to commit"
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
git push origin HEAD:${{ github.ref_name }}
4 changes: 2 additions & 2 deletions 0-Energy_Hardware_Optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ az aks update -g ResourceGroup -n EfficientAKS --enable-cluster-autoscaler --min

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1341-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-18</p>
<img src="https://img.shields.io/badge/Total%20views-52-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-20</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion 1-Cloud_k8s_Scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ foreach ($vm in $vmList) {

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-52-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-20</p>
</div>
<!-- END BADGE -->
Expand Down
2 changes: 1 addition & 1 deletion 2-Azure_Stack_Architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ Layer Interactions:

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-52-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-20</p>
</div>
<!-- END BADGE -->
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ From [K8s cluster components](https://kubernetes.io/docs/concepts/architecture/)

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-1341-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-18</p>
<img src="https://img.shields.io/badge/Total%20views-52-limegreen" alt="Total views">
<p>Refresh Date: 2025-08-20</p>
</div>
<!-- END BADGE -->
37 changes: 37 additions & 0 deletions metrics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
{
"date": "2025-07-07",
"count": 330,
"uniques": 20
},
{
"date": "2025-07-08",
"count": 159,
"uniques": 6
},
{
"date": "2025-07-10",
"count": 482,
"uniques": 1
},
{
"date": "2025-07-11",
"count": 170,
"uniques": 4
},
{
"date": "2025-07-12",
"count": 7,
"uniques": 1
},
{
"date": "2025-07-14",
"count": 130,
"uniques": 2
},
{
"date": "2025-07-15",
"count": 2,
"uniques": 1
}
]