Skip to content

Commit bf3a01f

Browse files
authored
Merge pull request #126 from Cloud2BR-MSFTLearningHub/chore/update-cloud2br-org-references
Update Cloud2BR organization references
2 parents 4b6f569 + 25b0615 commit bf3a01f

File tree

226 files changed

+1007
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

226 files changed

+1007
-1003
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
const REPO = process.env.REPO;
5+
const GITHUB_TOKEN = process.env.TRAFFIC_TOKEN;
6+
const METRICS_FILE = 'metrics.json';
7+
8+
if (!GITHUB_TOKEN || !REPO) {
9+
console.error('Error: TRAFFIC_TOKEN and REPO environment variables must be set.');
10+
process.exit(1);
11+
}
12+
13+
if (typeof fetch !== 'function') {
14+
console.error('Error: global fetch is not available. Use Node.js 20 or later.');
15+
process.exit(1);
16+
}
17+
18+
async function getLast14DaysTraffic() {
19+
const response = await fetch(`https://api.github.com/repos/${REPO}/traffic/views`, {
20+
headers: {
21+
Accept: 'application/vnd.github+json',
22+
Authorization: `Bearer ${GITHUB_TOKEN}`,
23+
'User-Agent': 'visitor-counter'
24+
}
25+
});
26+
27+
if (!response.ok) {
28+
const errorText = await response.text();
29+
throw new Error(
30+
`Failed to fetch traffic data: ${response.status} ${response.statusText}\n${errorText}`
31+
);
32+
}
33+
34+
const data = await response.json();
35+
return data.views.map((item) => ({
36+
date: item.timestamp.slice(0, 10),
37+
count: item.count,
38+
uniques: item.uniques
39+
}));
40+
}
41+
42+
function readMetrics() {
43+
if (!fs.existsSync(METRICS_FILE)) {
44+
return [];
45+
}
46+
47+
try {
48+
const raw = fs.readFileSync(METRICS_FILE, 'utf-8');
49+
const parsed = JSON.parse(raw);
50+
return Array.isArray(parsed) ? parsed : [];
51+
} catch {
52+
console.error('metrics.json is not valid JSON. Starting fresh.');
53+
return [];
54+
}
55+
}
56+
57+
function writeMetrics(metrics) {
58+
fs.writeFileSync(METRICS_FILE, JSON.stringify(metrics, null, 2));
59+
console.log(`metrics.json updated with ${metrics.length} days`);
60+
}
61+
62+
function mergeMetrics(existing, fetched) {
63+
const byDate = new Map();
64+
65+
for (const entry of existing) {
66+
byDate.set(entry.date, entry);
67+
}
68+
69+
for (const entry of fetched) {
70+
byDate.set(entry.date, entry);
71+
}
72+
73+
return [...byDate.values()].sort((left, right) => left.date.localeCompare(right.date));
74+
}
75+
76+
function calculateTotalViews(metrics) {
77+
return metrics.reduce((sum, entry) => sum + entry.count, 0);
78+
}
79+
80+
function findMarkdownFiles(dir) {
81+
let results = [];
82+
const entries = fs.readdirSync(dir, { withFileTypes: true });
83+
84+
for (const entry of entries) {
85+
const fullPath = path.join(dir, entry.name);
86+
if (entry.isDirectory()) {
87+
results = results.concat(findMarkdownFiles(fullPath));
88+
continue;
89+
}
90+
91+
if (entry.isFile() && entry.name.endsWith('.md')) {
92+
results.push(fullPath);
93+
}
94+
}
95+
96+
return results;
97+
}
98+
99+
function updateMarkdownBadges(totalViews) {
100+
const refreshDate = new Date().toISOString().split('T')[0];
101+
const badgeRegex = /<!-- START BADGE -->[\s\S]*?<!-- END BADGE -->/g;
102+
const badgeBlock = `<!-- START BADGE -->
103+
<div align="center">
104+
<img src="https://img.shields.io/badge/Total%20views-${totalViews}-limegreen" alt="Total views">
105+
<p>Refresh Date: ${refreshDate}</p>
106+
</div>
107+
<!-- END BADGE -->`;
108+
109+
for (const file of findMarkdownFiles('.')) {
110+
const content = fs.readFileSync(file, 'utf-8');
111+
if (!badgeRegex.test(content)) {
112+
continue;
113+
}
114+
115+
const updated = content.replace(badgeRegex, badgeBlock);
116+
fs.writeFileSync(file, updated);
117+
console.log(`Updated badge in ${file}`);
118+
}
119+
}
120+
121+
(async () => {
122+
try {
123+
const fetched = await getLast14DaysTraffic();
124+
const existing = readMetrics();
125+
const merged = mergeMetrics(existing, fetched);
126+
writeMetrics(merged);
127+
128+
const totalViews = calculateTotalViews(merged);
129+
updateMarkdownBadges(totalViews);
130+
} catch (error) {
131+
console.error(error);
132+
process.exit(1);
133+
}
134+
})();

.github/workflows/use-visitor-counter.yml

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,17 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424

25-
- name: Shallow clone visitor counter logic
26-
run: git clone --depth=1 https://github.com/brown9804/github-visitor-counter.git
27-
2825
- name: Set up Node.js
2926
uses: actions/setup-node@v4
3027
with:
3128
node-version: '20'
3229

33-
- name: Install dependencies for github-visitor-counter
34-
run: |
35-
cd github-visitor-counter
36-
npm ci
37-
3830
- name: Run visitor counter logic (updates markdown badges and metrics.json)
39-
run: node github-visitor-counter/update_repo_views_counter.js
31+
run: node .github/scripts/update_repo_views_counter.js
4032
env:
4133
TRAFFIC_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
4234
REPO: ${{ github.repository }}
4335

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-
5536
- name: Configure Git author
5637
run: |
5738
git config --global user.name "github-actions[bot]"
@@ -63,24 +44,50 @@ jobs:
6344
env:
6445
TOKEN: ${{ secrets.GITHUB_TOKEN }}
6546
run: |
66-
git fetch origin
67-
git checkout ${{ github.head_ref }}
68-
git pull origin ${{ github.head_ref }} || echo "No merge needed"
69-
git add -A
70-
git commit -m "Update visitor count" || echo "No changes to commit"
47+
BRANCH="${{ github.head_ref }}"
7148
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
72-
git push origin HEAD:${{ github.head_ref }}
49+
HAS_CHANGES=false
50+
if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
51+
HAS_CHANGES=true
52+
git stash push --include-untracked --message visitor-counter
53+
fi
54+
git fetch origin "$BRANCH"
55+
git checkout -B "$BRANCH" "origin/$BRANCH"
56+
if [ "$HAS_CHANGES" = true ]; then
57+
git stash pop
58+
fi
59+
git add -A
60+
if git diff --cached --quiet; then
61+
echo "No changes to commit"
62+
exit 0
63+
fi
64+
git commit -m "Update visitor count"
65+
git pull --rebase origin "$BRANCH"
66+
git push origin HEAD:"$BRANCH"
7367
7468
# Commit and push logic for non-PR events (merge, not rebase)
7569
- name: Commit and push changes (non-PR)
7670
if: github.event_name != 'pull_request'
7771
env:
7872
TOKEN: ${{ secrets.GITHUB_TOKEN }}
7973
run: |
80-
git fetch origin
81-
git checkout ${{ github.ref_name }} || git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }}
82-
git pull origin ${{ github.ref_name }} || echo "No merge needed"
83-
git add -A
84-
git commit -m "Update visitor count" || echo "No changes to commit"
74+
BRANCH="${{ github.ref_name }}"
8575
git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
86-
git push origin HEAD:${{ github.ref_name }}
76+
HAS_CHANGES=false
77+
if ! git diff --quiet || ! git diff --cached --quiet || [ -n "$(git ls-files --others --exclude-standard)" ]; then
78+
HAS_CHANGES=true
79+
git stash push --include-untracked --message visitor-counter
80+
fi
81+
git fetch origin "$BRANCH"
82+
git checkout -B "$BRANCH" "origin/$BRANCH"
83+
if [ "$HAS_CHANGES" = true ]; then
84+
git stash pop
85+
fi
86+
git add -A
87+
if git diff --cached --quiet; then
88+
echo "No changes to commit"
89+
exit 0
90+
fi
91+
git commit -m "Update visitor count"
92+
git pull --rebase origin "$BRANCH"
93+
git push origin HEAD:"$BRANCH"

0_Azure/0_AzureFundamentals/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ Costa Rica
44

55
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
66
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
7-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
8-
[brown9804](https://github.com/brown9804)
7+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
98

109
Last updated: 2026-01-29
1110

@@ -21,44 +20,44 @@ Last updated: 2026-01-29
2120

2221
## Types of Cloud Services
2322

24-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_types_of_cloud_services.png)
23+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_types_of_cloud_services.png)
2524

2625
## Azure CLoud Models
2726

28-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_cloud_models.png)
27+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_cloud_models.png)
2928

3029
## Azure Security Rules
3130

32-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_rules.png)
31+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_rules.png)
3332

3433
## Azure Security Network
3534

36-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_network.png)
35+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_network.png)
3736

3837
## Azure DDoS Protection
3938

40-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_network_DDos.png)
39+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_network_DDos.png)
4140

4241
## Azure Firewall Rules
4342

44-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules.png)
43+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules.png)
4544

46-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules_2.png)
45+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_firewall_rules_2.png)
4746

4847
## Azure Security Features Identity
4948

5049
### 1. Authentication & Authorization
51-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_Identity_AuthenticationAuthorization.png)
50+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_Identity_AuthenticationAuthorization.png)
5251

5352
### 2. Active Directory
54-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_AzureActiveDirectory.png)
53+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features_AzureActiveDirectory.png)
5554

5655
### 3. MFA
57-
![Alt text](https://github.com/brown9804/MSCloudEssentials_LPath/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features-identity-MFA.png)
56+
![Alt text](https://github.com/Cloud2BR-MSFTLearningHub/DemosScenarios-TechTalks/blob/main/0_Azure/img/AzureFundamentals/%5Bimg%5D_azure_security_features-identity-MFA.png)
5857

5958
<!-- START BADGE -->
6059
<div align="center">
61-
<img src="https://img.shields.io/badge/Total%20views-1535-limegreen" alt="Total views">
62-
<p>Refresh Date: 2026-01-29</p>
60+
<img src="https://img.shields.io/badge/Total%20views-1465-limegreen" alt="Total views">
61+
<p>Refresh Date: 2026-04-07</p>
6362
</div>
6463
<!-- END BADGE -->

0_Azure/1_AzureData/0_DataStorage/0_azure_blob_to_snowflake_connection.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

@@ -83,7 +82,7 @@ Last updated: 2026-01-29
8382

8483
<!-- START BADGE -->
8584
<div align="center">
86-
<img src="https://img.shields.io/badge/Total%20views-1535-limegreen" alt="Total views">
87-
<p>Refresh Date: 2026-01-29</p>
85+
<img src="https://img.shields.io/badge/Total%20views-1465-limegreen" alt="Total views">
86+
<p>Refresh Date: 2026-04-07</p>
8887
</div>
8988
<!-- END BADGE -->

0_Azure/1_AzureData/0_DataStorage/1_mvSharePoint_toAzStorage.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Costa Rica
44

55
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com)
6-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
7-
[brown9804](https://github.com/brown9804)
6+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
87

98
Last updated: 2026-01-29
109

@@ -120,7 +119,7 @@ Testing and Automation:
120119
121120
<!-- START BADGE -->
122121
<div align="center">
123-
<img src="https://img.shields.io/badge/Total%20views-1535-limegreen" alt="Total views">
124-
<p>Refresh Date: 2026-01-29</p>
122+
<img src="https://img.shields.io/badge/Total%20views-1465-limegreen" alt="Total views">
123+
<p>Refresh Date: 2026-04-07</p>
125124
</div>
126125
<!-- END BADGE -->

0_Azure/1_AzureData/0_DataStorage/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

@@ -50,7 +49,7 @@ graph TB
5049

5150
<!-- START BADGE -->
5251
<div align="center">
53-
<img src="https://img.shields.io/badge/Total%20views-1535-limegreen" alt="Total views">
54-
<p>Refresh Date: 2026-01-29</p>
52+
<img src="https://img.shields.io/badge/Total%20views-1465-limegreen" alt="Total views">
53+
<p>Refresh Date: 2026-04-07</p>
5554
</div>
5655
<!-- END BADGE -->

0_Azure/1_AzureData/1_Databases/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
Costa Rica
44

5-
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6-
[brown9804](https://github.com/brown9804)
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [Cloud2BR OSS - Learning Hub](https://github.com/Cloud2BR-MSFTLearningHub)
76

87
Last updated: 2026-01-29
98

@@ -12,7 +11,7 @@ Last updated: 2026-01-29
1211
> These functionalities include the ability to query data, manage relationships between different data items, enforce data integrity rules, and perform transactions. These products are typically used when you need to work with structured or unstructured data, and need more advanced features compared to basic data storage products.
1312
1413
<div align="center">
15-
<img src="https://github.com/brown9804/MSCloudEssentials_LPath/assets/24630902/697f7265-647a-41e2-a2f5-ec4b66cf3321" alt="Centered Image" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
14+
<img src="../../img/migrated-assets/azure-data-databases.png" alt="Centered Image" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
1615
</div>
1716

1817

@@ -69,7 +68,7 @@ graph LR
6968

7069
<!-- START BADGE -->
7170
<div align="center">
72-
<img src="https://img.shields.io/badge/Total%20views-1535-limegreen" alt="Total views">
73-
<p>Refresh Date: 2026-01-29</p>
71+
<img src="https://img.shields.io/badge/Total%20views-1465-limegreen" alt="Total views">
72+
<p>Refresh Date: 2026-04-07</p>
7473
</div>
7574
<!-- END BADGE -->

0 commit comments

Comments
 (0)