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
25 changes: 18 additions & 7 deletions .github/workflows/update-md-date.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -35,13 +36,23 @@ jobs:
- name: Update last modified date in Markdown files
run: python .github/workflows/update_date.py

- name: Commit changes
- name: Commit and merge changes
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
run: |
git fetch origin ${{ github.event.pull_request.head.ref }}
git pull --rebase origin ${{ github.event.pull_request.head.ref }} || echo "No rebase needed"
# Ensure we're on the correct branch
git switch -c "$PR_BRANCH" || git switch "$PR_BRANCH"

# Stage and commit changes if any
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 }}
git diff --staged --quiet || git commit -m "Update last modified date in Markdown files"

# Pull and merge existing changes
git pull origin "$PR_BRANCH" --no-rebase

# Push all changes
git push origin "$PR_BRANCH"
52 changes: 19 additions & 33 deletions .github/workflows/use-visitor-counter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}

- name: Shallow clone visitor counter logic
run: git clone --depth=1 https://github.com/brown9804/github-visitor-counter.git
Expand Down Expand Up @@ -57,38 +58,23 @@ jobs:
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'
- name: Commit and merge changes
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_BRANCH: ${{ github.head_ref || github.ref_name }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
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
# Ensure we're on the correct branch
git switch -c "$PR_BRANCH" || git switch "$PR_BRANCH"

# Stage and commit changes if any
git add -A
git diff --staged --quiet || git commit -m "Update visitor count"

# Pull and merge existing changes
git pull origin "$PR_BRANCH" --no-rebase

# Push all changes
git push origin "$PR_BRANCH"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Last updated: 2025-07-21

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-164-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-180-limegreen" alt="Total views">
<p>Refresh Date: 2025-07-21</p>
</div>
<!-- END BADGE -->
2 changes: 1 addition & 1 deletion terraform-infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ graph TD;

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-164-limegreen" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-180-limegreen" alt="Total views">
<p>Refresh Date: 2025-07-21</p>
</div>
<!-- END BADGE -->