Skip to content

Commit aec76fd

Browse files
authored
Merge pull request #8 from MicrosoftCloudEssentials-LearningHub/upgrade-pipelines-counter-logic
Upgrade pipelines counter logic
2 parents 2c045f0 + 1d10d92 commit aec76fd

File tree

10 files changed

+174
-26
lines changed

10 files changed

+174
-26
lines changed

.github/workflows/update-md-date.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
pull-requests: write
1011

1112
jobs:
1213
update-date:
@@ -35,7 +36,12 @@ jobs:
3536
run: python .github/workflows/update_date.py
3637

3738
- name: Commit changes
39+
env:
40+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
3841
run: |
42+
git fetch origin ${{ github.event.pull_request.head.ref }}
43+
git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
3944
git add -A
4045
git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
46+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
4147
git push origin HEAD:${{ github.event.pull_request.head.ref }}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Use Visitor Counter Logic
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: '0 0 * * *' # Runs daily at midnight
9+
workflow_dispatch: # Allows manual triggering
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
update-visitor-count:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout current repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Shallow clone visitor counter logic
26+
run: git clone --depth=1 https://github.com/brown9804/github-visitor-counter.git
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Install dependencies for github-visitor-counter
34+
run: |
35+
cd github-visitor-counter
36+
npm ci
37+
38+
- name: Run visitor counter logic (updates markdown badges and metrics.json)
39+
run: node github-visitor-counter/update_repo_views_counter.js
40+
env:
41+
TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
42+
REPO: ${{ github.repository }}
43+
44+
- name: Move generated metrics.json to root
45+
run: mv github-visitor-counter/metrics.json .
46+
47+
- name: List files for debugging
48+
run: |
49+
ls -l
50+
ls -l github-visitor-counter
51+
52+
- name: Clean up visitor counter logic
53+
run: rm -rf github-visitor-counter
54+
55+
- name: Configure Git author
56+
run: |
57+
git config --global user.name "github-actions[bot]"
58+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
59+
60+
# Commit and push logic for PR events
61+
- name: Commit and push changes (PR)
62+
if: github.event_name == 'pull_request'
63+
env:
64+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
run: |
66+
git fetch origin
67+
git checkout ${{ github.head_ref }}
68+
git add "*.md" metrics.json
69+
git commit -m "Update visitor count" || echo "No changes to commit"
70+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
71+
git pull --rebase origin ${{ github.head_ref }} || echo "No rebase needed"
72+
git push origin HEAD:${{ github.head_ref }}
73+
74+
# Commit and push logic for non-PR events (schedule, workflow_dispatch)
75+
- name: Commit and push changes (non-PR)
76+
if: github.event_name != 'pull_request'
77+
env:
78+
TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: |
80+
git fetch origin
81+
git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }}
82+
git add "*.md" metrics.json
83+
git commit -m "Update visitor count" || echo "No changes to commit"
84+
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
85+
git pull --rebase origin ${{ github.ref_name }} || echo "No rebase needed"
86+
git push origin HEAD:${{ github.ref_name }}
87+
88+
- name: Create Pull Request (non-PR)
89+
if: github.event_name != 'pull_request'
90+
uses: peter-evans/create-pull-request@v6
91+
with:
92+
token: ${{ secrets.GITHUB_TOKEN }}
93+
branch: update-visitor-count
94+
title: "Update visitor count"
95+
body: "Automated update of visitor count"
96+
base: main

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-05-06
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -286,8 +286,9 @@ Read more about [Endpoints for inference in production](https://learn.microsoft.
286286

287287
</details>
288288

289-
289+
<!-- START BADGE -->
290290
<div align="center">
291-
<h3 style="color: #4CAF50;">Total Visitors</h3>
292-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
291+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
292+
<p>Refresh Date: 2025-07-16</p>
293293
</div>
294+
<!-- END BADGE -->

azML-modelcreation/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-05-06
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

12-
1312
<details>
1413
<summary><b>List of References </b> (Click to expand)</summary>
1514

@@ -299,9 +298,9 @@ https://github.com/user-attachments/assets/1b3e5602-dc64-4c39-be72-ed1cbd74361e
299298

300299
> Once deployed, you can send HTTP requests to the endpoint to get predictions.
301300
302-
303-
301+
<!-- START BADGE -->
304302
<div align="center">
305-
<h3 style="color: #4CAF50;">Total Visitors</h3>
306-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
303+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
304+
<p>Refresh Date: 2025-07-16</p>
307305
</div>
306+
<!-- END BADGE -->

azML-modelcreation/data/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-04-29
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -18,8 +18,9 @@ Last updated: 2025-04-29
1818
- **Department**: The department where the employee works (e.g., HR, Engineering, Sales).
1919
- **Salary**: The employee's annual salary in USD, ranging from \$40,000 to \$120,000.
2020

21-
21+
<!-- START BADGE -->
2222
<div align="center">
23-
<h3 style="color: #4CAF50;">Total Visitors</h3>
24-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
23+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
24+
<p>Refresh Date: 2025-07-16</p>
2525
</div>
26+
<!-- END BADGE -->

infrastructure/azMachineLearning/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-04-29
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -141,7 +141,9 @@ graph TD;
141141
terraform destroy -var-file terraform.tfvars
142142
```
143143

144+
<!-- START BADGE -->
144145
<div align="center">
145-
<h3 style="color: #4CAF50;">Total Visitors</h3>
146-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
146+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
147+
<p>Refresh Date: 2025-07-16</p>
147148
</div>
149+
<!-- END BADGE -->

infrastructure/msFabric/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-04-29
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -154,7 +154,9 @@ graph TD;
154154

155155
<img width="550" alt="image" src="https://github.com/user-attachments/assets/f2089d03-3a3d-431d-b462-8148ef519104">
156156

157+
<!-- START BADGE -->
157158
<div align="center">
158-
<h3 style="color: #4CAF50;">Total Visitors</h3>
159-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
159+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
160+
<p>Refresh Date: 2025-07-16</p>
160161
</div>
162+
<!-- END BADGE -->

infrastructure/msFabric/troubleshooting.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-04-29
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -183,7 +183,9 @@ Error: Failed to get existing workspaces: Error retrieving keys for Storage Acco
183183
<img width="990" alt="image" src="https://github.com/user-attachments/assets/6c392d1e-32c5-4929-aaf7-6cdb853cf77d" />
184184
</p>
185185

186+
<!-- START BADGE -->
186187
<div align="center">
187-
<h3 style="color: #4CAF50;">Total Visitors</h3>
188-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
188+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
189+
<p>Refresh Date: 2025-07-16</p>
189190
</div>
191+
<!-- END BADGE -->

metrics.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"date": "2025-07-07",
4+
"count": 330,
5+
"uniques": 20
6+
},
7+
{
8+
"date": "2025-07-08",
9+
"count": 159,
10+
"uniques": 6
11+
},
12+
{
13+
"date": "2025-07-10",
14+
"count": 482,
15+
"uniques": 1
16+
},
17+
{
18+
"date": "2025-07-11",
19+
"count": 170,
20+
"uniques": 4
21+
},
22+
{
23+
"date": "2025-07-12",
24+
"count": 7,
25+
"uniques": 1
26+
},
27+
{
28+
"date": "2025-07-14",
29+
"count": 130,
30+
"uniques": 2
31+
},
32+
{
33+
"date": "2025-07-15",
34+
"count": 2,
35+
"uniques": 1
36+
}
37+
]

msFabric-AI_integration/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Costa Rica
55
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
66
[brown9804](https://github.com/brown9804)
77

8-
Last updated: 2025-04-29
8+
Last updated: 2025-07-16
99

1010
------------------------------------------
1111

@@ -397,7 +397,9 @@ Make sure to replace `"your_openai_api_key"`, `"https://your_openai_api_base/"`,
397397
pprint(dict(rm), indent=4)
398398
```
399399
400+
<!-- START BADGE -->
400401
<div align="center">
401-
<h3 style="color: #4CAF50;">Total Visitors</h3>
402-
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
402+
<img src="https://img.shields.io/badge/Total%20views-9-limegreen" alt="Total views">
403+
<p>Refresh Date: 2025-07-16</p>
403404
</div>
405+
<!-- END BADGE -->

0 commit comments

Comments
 (0)