Skip to content

Update pandas requirement from >=2.2.2 to >=3.0.2 #182

Update pandas requirement from >=2.2.2 to >=3.0.2

Update pandas requirement from >=2.2.2 to >=3.0.2 #182

name: Use Visitor Counter Logic
on:
pull_request:
branches: [main]
workflow_dispatch:
# schedule:
# - cron: '0 0 * * *' # Runs daily at midnight
permissions:
contents: write
pull-requests: write
# Prevent parallel runs from racing on the same branch
concurrency:
group: visitor-counter-${{ github.repository }}-${{ github.event.pull_request.head.ref || github.ref_name }}
cancel-in-progress: true
jobs:
update-visitor-count:
runs-on: ubuntu-latest
steps:
# Checkout the *actual branch* we intend to push to
# (avoids being on refs/pull/<id>/merge and needing a later checkout)
- name: Checkout target branch
uses: actions/checkout@v4
with:
fetch-depth: 0
clean: true
persist-credentials: false
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
- name: Configure Git author
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Optional but recommended: sync before generating changes (no checkout later)
- name: Sync branch with origin
env:
TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
run: |
git fetch origin "$TARGET_REF"
git pull --no-rebase --no-edit origin "$TARGET_REF" || true
- 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: Clean up visitor counter logic
run: rm -rf github-visitor-counter
- name: Commit and push (only if changed)
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
TARGET_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit"
exit 0
fi
git add -A
git commit -m "Update visitor count"
git push "https://x-access-token:${TOKEN}@github.com/${{ github.repository }}" "HEAD:${TARGET_REF}"