Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f969d85
testing
brown9804 Jul 10, 2025
098ea63
Merge f969d85146062aed9ba89252d9f504179f1565b8 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
3a8eeda
updating rebase
brown9804 Jul 10, 2025
3eb3253
Update visitor count
github-actions[bot] Jul 10, 2025
4f4dd07
branch conflict resolving
brown9804 Jul 10, 2025
a6cba9f
Merge 4f4dd07337224e9701a91cb843d2f65a2860da1e into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
489cda7
Update visitor count
github-actions[bot] Jul 10, 2025
200d4f3
extended explanation
brown9804 Jul 10, 2025
e8e1af3
Merge 200d4f3807f30772d8310f62ebd146473749a9c0 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
4abd7cf
Update visitor count
github-actions[bot] Jul 10, 2025
8b064ce
note for where the badge is
brown9804 Jul 10, 2025
f005290
Merge 8b064ce1d1f5eac8494314b2d8986ce4cc901a5e into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
f16104f
Update visitor count
github-actions[bot] Jul 10, 2025
349f527
testing if not catching markdown example
brown9804 Jul 10, 2025
b69a81d
Merge 349f5278206d92c7a56c3cbcd6c3376957f818a8 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
d024395
Update visitor count
github-actions[bot] Jul 10, 2025
f1e2994
testing and formatting
brown9804 Jul 10, 2025
28be3d1
Update visitor count
github-actions[bot] Jul 10, 2025
3bcea12
testing
brown9804 Jul 10, 2025
82b36d6
Merge 3bcea12d37459b6d782f96a0a8badcc96ba18071 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
c77469f
Update visitor count
github-actions[bot] Jul 10, 2025
d76357c
testing
brown9804 Jul 10, 2025
417b0dc
Merge d76357cff7ad343b29c6885b5df22b4a14cf9761 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
85370a2
Update visitor count
github-actions[bot] Jul 10, 2025
a5ed186
format for markdowns adjusted
brown9804 Jul 10, 2025
48c44b6
Merge a5ed186ea1e593000850785f47cdb91a70473723 into 07ad9e36b7f82aa0e…
brown9804 Jul 10, 2025
06eee87
Update visitor count
github-actions[bot] Jul 10, 2025
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
2 changes: 2 additions & 0 deletions .github/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"default": true,
"MD003": false,
"MD005": false,
"MD009": false,
"MD013": false,
"MD028": false,
"MD029": false,
"MD033": false,
"MD036": false,
"MD048": false,
"MD040": false,
"MD041": false,
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/update-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,17 @@ jobs:
git push origin HEAD:${{ github.event.pull_request.head.ref }}

- name: Commit and push to new branch (non-PR)
if: github.event_name != 'pull_request'
id: push
if: github.event_name == 'pull_request'
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="update-visitor-count-$(date +%s)"
git checkout -b $BRANCH
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 -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 $BRANCH
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
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'
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,7 @@ Last updated: 2025-07-10

## How to use it

1. **Add the Badge to Your Repository**:
- Include the following markdown in your `README.md` file:

```markdown
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-12345-yellow" alt="Total views">
<p>Refresh Date: 2025-07-10</p>
</div>
```

1. **Add the Badge to Your Repository**: Include the following markdown in your `README.md` file, between the `START BADGE` and `END BADGE` (included), as shown in the bottom.
2. **Create a Personal Access Token**:
- Go to **GitHub Settings** > **Developer Settings** > **Personal Access Tokens**.
- Generate a new token with `repo` access.
Expand Down Expand Up @@ -83,7 +74,9 @@ jobs:
> - Use a Personal Access Token (PAT) with `repo` access as `TRAFFIC_TOKEN` secret in each target repository.
> - The action will trigger the visitor counter logic in the main repository and update the badge dynamically.

<!-- START BADGE -->
<div align="center">
<img src="https://img.shields.io/badge/Total%20views-12345-yellow" alt="Total views">
<img src="https://img.shields.io/badge/Total%20views-734-yellow" alt="Total views">
<p>Refresh Date: 2025-07-10</p>
</div>
<!-- END BADGE -->
4 changes: 2 additions & 2 deletions metrics.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"count": 611,
"lastUpdated": "2025-07-10T16:52:58.787Z"
"count": 734,
"lastUpdated": "2025-07-10T17:27:34.741Z"
}
9 changes: 6 additions & 3 deletions update_repo_views_counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ function updateMetricsFile(count) {

function updateReadmeFile(count) {
const refreshDate = new Date().toISOString().split('T')[0];
const badge = `<div align="center">\n <img src="https://img.shields.io/badge/Total%20views-${count}-yellow" alt="Total views">\n <p>Refresh Date: ${refreshDate}</p>\n</div>`;
const badge = `<div align="center">
<img src="https://img.shields.io/badge/Total%20views-${count}-yellow" alt="Total views">
<p>Refresh Date: ${refreshDate}</p>
</div>`;

const readme = fs.readFileSync(README_FILE, 'utf-8');
const updatedReadme = readme.replace(
/<div align="center">[\s\S]*?<p>Refresh Date:.*?<\/p>\n<\/div>/,
badge
/<!-- START BADGE -->[\s\S]*?<!-- END BADGE -->/,
`<!-- START BADGE -->\n${badge}\n<!-- END BADGE -->`
);

fs.writeFileSync(README_FILE, updatedReadme);
Expand Down