-
Notifications
You must be signed in to change notification settings - Fork 7
103 lines (85 loc) · 2.9 KB
/
Copy pathupdate-profile-readme.yml
File metadata and controls
103 lines (85 loc) · 2.9 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Update Profile README
on:
# Trigger when STARRED_REPOS.md changes
push:
branches: [main]
paths:
- 'STARRED_REPOS.md'
- 'starred_data.json'
# Or trigger manually
workflow_dispatch:
inputs:
profile_repo:
description: 'Profile repo (username/username or org/.github)'
required: false
type: string
max_repos:
description: 'Max repos to show in README'
required: false
type: number
default: 50
max_categories:
description: 'Max categories to show'
required: false
type: number
default: 10
jobs:
update-profile:
runs-on: ubuntu-latest
steps:
- name: Checkout starred repo
uses: actions/checkout@v4
with:
path: starred
- name: Determine profile repo
id: profile
run: |
PROFILE_REPO="${{ inputs.profile_repo }}"
if [ -z "$PROFILE_REPO" ]; then
# Default: user's profile repo (username/username)
PROFILE_REPO="${{ github.repository_owner }}/${{ github.repository_owner }}"
fi
echo "repo=$PROFILE_REPO" >> $GITHUB_OUTPUT
echo "Will update README in: $PROFILE_REPO"
- name: Checkout profile repo
uses: actions/checkout@v4
with:
repository: ${{ steps.profile.outputs.repo }}
token: ${{ secrets.PROFILE_REPO_TOKEN || secrets.GH_PAT }}
path: profile
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install starred
run: |
cd starred
pip install -e .
- name: Update profile README
run: |
cd starred
# Check if profile README exists and has placeholders
PROFILE_README="../profile/README.md"
if [ ! -f "$PROFILE_README" ]; then
echo "Creating profile README with placeholders..."
starred update-readme --readme "$PROFILE_README" --create-template
fi
# Update the README
starred update-readme \
--readme "$PROFILE_README" \
--data starred_data.json \
--max-repos ${{ inputs.max_repos || 50 }} \
--max-categories ${{ inputs.max_categories || 10 }}
- name: Commit and push to profile repo
run: |
cd profile
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: update starred repos section"
git push
echo "✅ Updated profile README"
fi