Skip to content

Commit 52da8a7

Browse files
committed
fix: update profile readme with descriptions and make codes DRY
1 parent c57c132 commit 52da8a7

3 files changed

Lines changed: 135 additions & 94 deletions

File tree

.github/workflows/update-profile-readme.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ on:
2525
required: false
2626
type: number
2727
default: 10
28+
include_toc:
29+
description: 'Include table of contents'
30+
required: false
31+
type: boolean
32+
default: false
33+
include_description:
34+
description: 'Include repo descriptions'
35+
required: false
36+
type: boolean
37+
default: false
2838

2939
jobs:
3040
update-profile:
@@ -78,12 +88,21 @@ jobs:
7888
starred update-readme --readme "$PROFILE_README" --create-template
7989
fi
8090
81-
# Update the README
82-
starred update-readme \
83-
--readme "$PROFILE_README" \
84-
--data starred_data.json \
85-
--max-repos ${{ inputs.max_repos || 50 }} \
86-
--max-categories ${{ inputs.max_categories || 10 }}
91+
# Build command with optional flags
92+
CMD="starred update-readme --readme $PROFILE_README --data starred_data.json"
93+
CMD="$CMD --max-repos ${{ inputs.max_repos || 50 }}"
94+
CMD="$CMD --max-categories ${{ inputs.max_categories || 10 }}"
95+
96+
if [ "${{ inputs.include_toc }}" == "true" ]; then
97+
CMD="$CMD --include-toc"
98+
fi
99+
100+
if [ "${{ inputs.include_description }}" == "true" ]; then
101+
CMD="$CMD --include-description"
102+
fi
103+
104+
# Run the command
105+
eval $CMD
87106
88107
- name: Commit and push to profile repo
89108
run: |
@@ -100,4 +119,4 @@ jobs:
100119
git commit -m "chore: update starred repos section"
101120
git push
102121
echo "✅ Updated profile README"
103-
fi
122+
fi

src/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def cmd_update_readme(args):
170170
categorized,
171171
max_repos=args.max_repos,
172172
max_categories=args.max_categories,
173+
include_toc=args.include_toc,
174+
include_description=args.include_description,
173175
create_if_missing=args.create,
174176
)
175177

@@ -327,6 +329,8 @@ def main():
327329
readme_parser.add_argument("--data", "-d", help="Path to starred_data.json")
328330
readme_parser.add_argument("--max-repos", type=int, default=50, help="Max repos to show")
329331
readme_parser.add_argument("--max-categories", type=int, default=10, help="Max categories")
332+
readme_parser.add_argument("--include-toc", action="store_true", help="Include table of contents")
333+
readme_parser.add_argument("--include-description", action="store_true", help="Include repo descriptions")
330334
readme_parser.add_argument("--create", action="store_true", help="Create README if missing")
331335
readme_parser.add_argument("--create-template", action="store_true", help="Create template README")
332336

@@ -370,4 +374,4 @@ def main():
370374

371375

372376
if __name__ == "__main__":
373-
sys.exit(main())
377+
sys.exit(main())

0 commit comments

Comments
 (0)