-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (61 loc) · 2.03 KB
/
github_followers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: GitHub Follower Bot
on:
schedule:
- cron: '0 23 * * *' # Runs once a day
workflow_dispatch:
permissions:
contents: write # Needed for committing and pushing changes
actions: read
packages: write
defaults:
run:
working-directory: ./github-followers
jobs:
follow-bot:
runs-on: ubuntu-latest
env:
GITHUB_USER: trcjr
PERSONAL_GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8' # Consider updating to a newer version if possible
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install Pipenv
run: pip install pipenv
- name: Cache Pipenv dependencies
uses: actions/cache@v4
with:
path: |
~/.local/share/pipenv
~/.cache/pip
~/.venv
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
- name: Install dependencies
run: pipenv install --deploy --ignore-pipfile
- name: Verify Pipenv Installation
run: pipenv --version
- name: List Installed Packages
run: pipenv run pip list
- name: Run Follower Bot
env:
GITHUB_USER: ${{ env.GITHUB_USER }}
PERSONAL_GITHUB_TOKEN: ${{ env.PERSONAL_GITHUB_TOKEN }}
run: pipenv run python github_follow_followers.py
- name: Commit and Push Changes
if: github.ref == 'refs/heads/main' # Ensures it runs only on the main branch
run: |
git config user.name "GitHub Follower Bot"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
git commit -m "Automated Commit: ${timestamp} (UTC)" || echo "No changes to commit."
git push origin main