A GitHub Action to automatically maintain GitHub streaks by creating and updating a file multiple times daily.
Follow these steps to prepare and release a new version of the Auto-Streak Keeper action:
-
Install Dependencies: Ensure you have the required dependencies installed:
npm install
-
Bundle Dependencies: Use
@vercel/nccto bundle all dependencies into a single file for distribution:npx @vercel/ncc build index.js --license licenses.txt
-
Update
action.yml: Ensure themainfield inaction.ymlpoints to the bundled file:runs: using: "node20" main: "dist/index.js"
file-path(optional): Path to the file to create/update. Default:public/auto-streak/data.txt.min-commits(optional): Minimum number of commits daily. Default:1.max-commits(optional): Maximum number of commits daily. Default:15.commit-message(optional): Commit message for the updates. Default:Auto-streak update.user-name: GitHub username. Default:${{ secrets.GITHUB_USER_NAME }}.user-email: GitHub user email. Default:${{ secrets.GITHUB_USER_EMAIL }}.github-token: GitHub token. Default:${{ secrets.GITHUB_TOKEN }}.branch-name(optional): Branch name to push the updates. Default:main.
name: Maintain GitHub Streak
on:
schedule:
- cron: "0 0 * * *" # Runs daily at midnight
workflow_dispatch:
jobs:
auto-streak:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Run Auto-Streak Keeper
uses: bmiit145/auto-streak-keeper@v1.0.1
with:
file-path: "public/auto-streak/data.txt"
min-commits: 2
max-commits: 5
commit-message: "Daily streak maintenance"
user-name: ${{ secrets.GITHUB_USER_NAME }}
user-email: ${{ secrets.GITHUB_USER_EMAIL }}
github-token: ${{ secrets.GITHUB_TOKEN }}
branch-name: "main"- Create a
.github/workflowsfolder in a test repository. - Add a workflow YAML file (e.g.,
auto-streak.yml). - Push the changes and verify the action works as expected.
To publish a new version of the Auto-Streak Keeper action:
- Follow the deployment steps above.
- Increment the version tag (e.g.,
v1.0.1 -> v1.0.2). - Update the action version in any workflows using it.
This ensures the Auto-Streak Keeper is not only user-ready but also easy for developers to maintain and enhance. Let me know if you need further adjustments!
To prevent bot detection on GitHub, a random delay between 1 to 5 seconds is added after each commit. This makes the commit activity appear more human-like and avoids triggering GitHub's bot detection mechanisms.