Self-updating profile README — no third-party services, GraphQL only #190069
Replies: 1 comment
-
|
I do exactly this on my profile. Here's the approach: 1. GitHub Action (scheduled + manual trigger)name: Update README
on:
schedule:
- cron: "0 */6 * * *" # every 6 hours
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch and update
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python update_readme.py
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git diff --quiet || (git add README.md && git commit -m "chore: update README" && git push)2. Python script using GraphQLimport os, json, urllib.request
TOKEN = os.environ["GH_TOKEN"]
USERNAME = "your-username"
def graphql(query):
req = urllib.request.Request(
"https://api.github.com/graphql",
data=json.dumps({"query": query}).encode(),
headers={"Authorization": f"bearer {TOKEN}", "Content-Type": "application/json"}
)
return json.loads(urllib.request.urlopen(req).read())
# Fetch pinned repos
result = graphql(f"""
{{
user(login: "{USERNAME}") {{
pinnedItems(first: 6, types: REPOSITORY) {{
nodes {{ ... on Repository {{ name description url stargazerCount }} }}
}}
contributionsCollection {{
totalCommitContributions
totalPullRequestContributions
}}
}}
}}
""")
user = result["data"]["user"]
pinned = user["pinnedItems"]["nodes"]
contribs = user["contributionsCollection"]3. Template your READMEUse markers in your README.md like No third-party actions needed - just For blog posts, you can fetch your RSS feed with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
General
Discussion Details
How do you build a self-updating GitHub profile README that automatically reflects your latest activity (pinned repos, recent commits, blog posts) without using third-party services — using only GitHub Actions and the GitHub GraphQL API?
Beta Was this translation helpful? Give feedback.
All reactions