Live-inject recent GitHub events into your README with a highly customizable JSON mapping.
Here's how the setup looks like in action: My Readme
name: Update Activity Timeline
on:
workflow_dispatch:
schedule:
- cron: '0 \* \* \* \*' # Customize CRON run timing - like this it runs hourly
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fetch & Render Activity
uses: FreddyMSchubert/github-activity-timeline@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
username: "YourUser" # Insert your username here
max_items: "5"
event_templates: > # Customize what to display here
{ /* see "Configuration" below */ }
- name: Commit & Push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add README.md && git diff --cached --quiet || git commit -m "chore: update activity"
- uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "main"If you don't want to dive deep into the customization opportunities, you can copy my config.
<!-- ACTIVITY:START -->
<!-- ACTIVITY:END -->
Don't put anything else between these markers as all of it will be replaced with the generated events list upon workflow run.
Provide a JSON object mapping event keys β JS template strings.
Format:{ "event_key": "Your string with {{placeholders}}", β¦ }.
Missing keys or empty strings ("") skip that event.
Example skeleton
{
"issues_opened": "...",
"pr_merged": "...",
"push": "..."
}Use event_templates to map each event key to a JS template string.
Placeholders inside {{β¦}} (e.g. {{payload.issue.number}}) are replaced with real values from the GitHub event when the workflow runs.
Here are some usage examples for useful event keys:
-
Description: New issue created.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#issues π
-
Top Variables:
payload.issue.numberβ Issue number π’payload.issue.titleβ Issue title π·οΈpayload.issue.html_urlβ Link to the issue πactorβ Who opened it π€- ...
-
Example Template:
"issues_opened": "{{index}}. π Opened [{{repo}}#{{payload.issue.number}}]({{payload.issue.html_url}}): β{{payload.issue.title.slice(0,50)}}β¦β"
-
Rendered Output:
- π Opened octocat/Hello-World#42: βImprove README examplesβ¦β
-
Description: Issue closed (anyone).
-
Docs: https://docs.github.com/en/webhooks/event-payloads#issues π
-
Top Variables:
payload.issue.numberβ Issue number π’payload.issue.html_urlβ Link to the issue πactorβ Who closed it π€- ...
-
Example Template:
"issues_closed": "{{index}}. β Closed [{{repo}}#{{payload.issue.number}}]({{payload.issue.html_url}}) by {{actor}}"
-
Rendered Output:
- β Closed octocat/Hello-World#42 by octocat
-
Description: Comment added to an issue.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#issue_comment π
-
Top Variables:
payload.comment.bodyβ Comment text π¬payload.comment.html_urlβ Link to the comment πpayload.issue.numberβ Issue number π’actorβ Who commented π€- ...
-
Example Template:
"issue_commented": "{{index}}. π¬ {{actor}} commented on [{{repo}}#{{payload.issue.number}}]({{payload.comment.html_url}}): β{{payload.comment.body.slice(0,50)}}β¦β"
-
Rendered Output:
- π¬ octocat commented on octocat/Hello-World#42: βLooks good to me, butβ¦β
-
Description: Pull request opened.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#pull_request π
-
Top Variables:
payload.pull_request.numberβ PR number π’payload.pull_request.titleβ PR title π·οΈpayload.pull_request.html_urlβ Link to the PR πactorβ Who opened it π€- ...
-
Example Template:
"pr_opened": "{{index}}. π PR [{{repo}}#{{payload.pull_request.number}}]({{payload.pull_request.html_url}}) opened: β{{payload.pull_request.title.slice(0,50)}}β¦β"
-
Rendered Output:
- π PR octocat/Hello-World#56 opened: βAdd CONTRIBUTING guideβ¦β
-
Description: PR closed, with or without merge.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#pull_request π
-
Top Variables:
payload.pull_request.numberβ PR number π’payload.pull_request.html_urlβ Link to the PR πactorβ Who performed the action π€payload.pull_request.mergedβtrueif merged;falseif just closed π- ...
-
Example Template:
"pr_closed": "{{index}}. {{payload.pull_request.merged ? 'π― Merged' : 'β Closed'}} PR [{{repo}}#{{payload.pull_request.number}}]({{payload.pull_request.html_url}}) by {{actor}}"
-
Rendered Output:
- π― Merged PR octocat/Hello-World#56 by octocat
-
Description: Review approval or change request.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#pull_request_review π
-
Top Variables:
payload.review.stateβapprovedorchanges_requestedπpayload.pull_request.numberβ PR number π’actorβ Who reviewed π€- ...
-
Example Template:
"pr_review_approved": "{{index}}. π {{actor}} approved PR [{{repo}}#{{payload.pull_request.number}}]({{payload.pull_request.html_url}})", "pr_review_changes_requested": "{{index}}. π© {{actor}} requested changes on PR [{{repo}}#{{payload.pull_request.number}}]({{payload.pull_request.html_url}})"
-
Rendered Output:
- π octocat approved PR octocat/Hello-World#56
- π© octocat requested changes on PR octocat/Hello-World#56
-
Description: Comment on a PR review.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#pull_request_review_comment π
-
Top Variables:
payload.comment.bodyβ Comment text π¬payload.comment.html_urlβ Link to the comment πpayload.pull_request.numberβ PR number π’actorβ Who commented π€- ...
-
Example Template:
"pr_review_comment": "{{index}}. π£ {{actor}} commented on review for PR [{{repo}}#{{payload.pull_request.number}}]({{payload.comment.html_url}}): β{{payload.comment.body.slice(0,50)}}β¦β"
-
Rendered Output:
- π£ octocat commented on review for PR octocat/Hello-World#56: βNit: rename this variableβ¦β
Description: One or more commits pushed.
Docs: https://docs.github.com/en/webhooks/event-payloads#push π
Top Variables:
payload.commits.lengthβ Number of commits π¦payload.refβ Branch ref (e.g.refs/heads/main) πΏpayload.compareβ Comparison URL πpayload.commits[payload.commits.length-1].messageorpayload.head_commit.messageβ Latest commit message πactorβ Who pushed π€- ...
Example Template:
"push": "{{index}}. π {{actor}} pushed {{payload.commits.length}} commits to [{{repo_owner}}/{{repo_name}}@{{payload.ref.replace('refs/heads/','')}}]({{payload.compare}}): β{{payload.commits[payload.commits.length-1].message.slice(0,50)}}β¦β"Rendered Output:
- π octocat pushed 3 commits to octocat/Hello-World@main: βFix typo in docsβ¦β
-
Description: Release published or updated.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#release π
-
Top Variables:
payload.release.tag_nameβ Tag (e.g.v1.2.3) πpayload.release.html_urlβ Link to release πpayload.release.prereleaseβtrueif prereleaseπ ΏοΈ actorβ Who released π€- ...
-
Example Template:
"release": "{{index}}. π‘ Released [{{repo}}@{{payload.release.tag_name}}]({{payload.release.html_url}})"
-
Rendered Output:
- π‘ Released octocat/[email protected]
-
Description: Repository forked.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#fork π
-
Top Variables:
payload.forkee.full_nameβ New fork name π±payload.forkee.html_urlβ Link to fork πrepoβ Original repo name πΊactorβ Who forked π€- ...
-
Example Template:
"fork": "{{index}}. π΄ Forked [{{repo}}]({{`https://github.com/${repo}`}}) to [{{payload.forkee.full_name}}]({{payload.forkee.html_url}})"
-
Rendered Output:
- π΄ Forked octocat/Hello-World to octocat/Hello-World-Fork
-
Description: Private repo made public.
-
Docs: https://docs.github.com/en/webhooks/event-payloads#public π
-
Top Variables:
repoβ Repo name ποΈactorβ Who changed visibility π€- ...
-
Example Template:
"public": "{{index}}. πΈ Made [{{repo}}]({{`https://github.com/${repo}`}}) public"
-
Rendered Output:
- πΈ Made octocat/Hello-World public