Follow-back GitHub bot #13763
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Follow-back GitHub bot | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
on: | |
schedule: | |
- cron: '*/10 * * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write # Allows committing and pushing changes | |
issues: write # Allows creating and managing issues | |
pull-requests: write # Allows managing pull requests | |
actions: write # Allows updating GitHub Actions workflows | |
jobs: | |
up-and-running: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get working copy | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 1 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install pipenv | |
run: pip install pipenv --user | |
- name: Setup Python virtual environment | |
run: | | |
PATH=$PATH:/home/milaabl/.local/bin | |
pipenv install | |
- name: Run Follower bot | |
run: | | |
export github_user=milaabl | |
export personal_github_token=${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
pipenv run python bot.py | |
- name: Commit and push if it changed | |
run: | | |
git config user.name "milaabl" | |
git config user.email "milaabl2405@gmail.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Works like a clockwork ⏳⌛⌚⏲️: ${timestamp}(UTC)" || exit 0 | |
git pull origin main | |
git push origin main |