From c3cca5e95f32257a4ba9abea6e0f829eb2c82a33 Mon Sep 17 00:00:00 2001
From: Timna Brown <24630902+brown9804@users.noreply.github.com>
Date: Wed, 16 Jul 2025 09:45:56 -0600
Subject: [PATCH 1/9] pull -> push added
---
.github/workflows/update-md-date.yml | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/update-md-date.yml b/.github/workflows/update-md-date.yml
index 96dc9d7..3792859 100644
--- a/.github/workflows/update-md-date.yml
+++ b/.github/workflows/update-md-date.yml
@@ -7,7 +7,8 @@ on:
permissions:
contents: write
-
+ pull-requests: write
+
jobs:
update-date:
runs-on: ubuntu-latest
@@ -30,12 +31,17 @@ jobs:
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
-
+
- name: Update last modified date in Markdown files
run: python .github/workflows/update_date.py
- name: Commit changes
+ env:
+ TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
+ git fetch origin
+ git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
git add -A
git commit -m "Update last modified date in Markdown files" || echo "No changes to commit"
+ git remote set-url origin https://x-access-token:${TOKEN}@github.com/${{ github.repository }}
git push origin HEAD:${{ github.event.pull_request.head.ref }}
From 691a6afb253a88cb9bd9d146379a9f41fe471242 Mon Sep 17 00:00:00 2001
From: Timna Brown <24630902+brown9804@users.noreply.github.com>
Date: Wed, 16 Jul 2025 09:50:34 -0600
Subject: [PATCH 2/9] avoid conflicts with parallel process
---
.github/workflows/validate_and_fix_markdown.yml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/validate_and_fix_markdown.yml b/.github/workflows/validate_and_fix_markdown.yml
index 1d36407..4cef7ef 100644
--- a/.github/workflows/validate_and_fix_markdown.yml
+++ b/.github/workflows/validate_and_fix_markdown.yml
@@ -7,6 +7,7 @@ on:
permissions:
contents: write
+ pull-requests: write
jobs:
validate-and-fix-markdown:
@@ -34,11 +35,11 @@ jobs:
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- - name: Commit changes
+ - name: Commit and rebase changes
+ env:
+ PR_BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
- git fetch origin
- git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
git add -A
git commit -m "Fix Markdown syntax issues" || echo "No changes to commit"
- git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
- git push origin HEAD:${{ github.event.pull_request.head.ref }}
+ git pull --rebase origin "$PR_BRANCH" || echo "No rebase needed"
+ git push origin HEAD:"$PR_BRANCH"
From 015587111ff23b9543fa020364e71b2e8bbfa7b9 Mon Sep 17 00:00:00 2001
From: Timna Brown <24630902+brown9804@users.noreply.github.com>
Date: Wed, 16 Jul 2025 09:51:13 -0600
Subject: [PATCH 3/9] counter logic added
---
.github/workflows/use-visitor-counter.yml | 94 +++++++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 .github/workflows/use-visitor-counter.yml
diff --git a/.github/workflows/use-visitor-counter.yml b/.github/workflows/use-visitor-counter.yml
new file mode 100644
index 0000000..4aa2c96
--- /dev/null
+++ b/.github/workflows/use-visitor-counter.yml
@@ -0,0 +1,94 @@
+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"
+
+ - name: Commit and push changes (PR)
+ if: github.event_name == 'pull_request'
+ env:
+ TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ git fetch origin
+ git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
+ git add "*.md" metrics.json
+ 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 pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
+ git push origin HEAD:${{ github.event.pull_request.head.ref }}
+
+ - 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.event.pull_request.head.ref }} || git checkout -b ${{ github.event.pull_request.head.ref }} origin/${{ github.event.pull_request.head.ref }}
+ git add "*.md" metrics.json
+ 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 pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
+ git push origin HEAD:${{ github.event.pull_request.head.ref }}
+
+ - name: Create Pull Request (non-PR)
+ if: github.event_name != 'pull_request'
+ uses: peter-evans/create-pull-request@v6
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ branch: update-visitor-count
+ title: "Update visitor count"
+ body: "Automated update of visitor count"
+ base: main
From 9bcbc8162c71a4234c0d1a8aa2ce878e2eb3604a Mon Sep 17 00:00:00 2001
From: Timna Brown <24630902+brown9804@users.noreply.github.com>
Date: Wed, 16 Jul 2025 09:51:48 -0600
Subject: [PATCH 4/9] adjusting badge format
---
terraform-infrastructure/README.md | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/terraform-infrastructure/README.md b/terraform-infrastructure/README.md
index aa118ea..96f22e6 100644
--- a/terraform-infrastructure/README.md
+++ b/terraform-infrastructure/README.md
@@ -107,7 +107,9 @@ graph TD;
+
Refresh Date: 2025-07-16
Refresh Date: 2025-07-16
Refresh Date: 2025-07-16
Refresh Date: 2025-07-16