Skip to content

README Workflow recent actions on GitHub stylish display

License

Notifications You must be signed in to change notification settings

FreddyMSchubert/github-activity-timeline

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ GitHub Activity Timeline Action

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

πŸš€ Quick Setup

1. Create workflow at .github/workflows/activity-timeline.yml:

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.

2. Annotate your README where updates belong:

<!-- 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.

βš™οΈ Configuration: event_templates

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": "..."
}

πŸ—‚οΈ Available Event Keys & Payload Properties

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:


issues_opened

  • 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:

  1. πŸ› Opened octocat/Hello-World#42: β€œImprove README examples…”

issues_closed

  • 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:

  1. βœ… Closed octocat/Hello-World#42 by octocat

issue_commented

  • 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:

  1. πŸ’¬ octocat commented on octocat/Hello-World#42: β€œLooks good to me, but…”

pr_opened

  • 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:

  1. πŸ†• PR octocat/Hello-World#56 opened: β€œAdd CONTRIBUTING guide…”

pr_closed & pr_merged

  • 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 – true if merged; false if 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:

  1. 🎯 Merged PR octocat/Hello-World#56 by octocat

pr_review_approved & pr_review_changes_requested

  • Description: Review approval or change request.

  • Docs: https://docs.github.com/en/webhooks/event-payloads#pull_request_review πŸ“‘

  • Top Variables:

    • payload.review.state – approved or changes_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:

  1. πŸ‘ octocat approved PR octocat/Hello-World#56
  2. 🚩 octocat requested changes on PR octocat/Hello-World#56

pr_review_comment

  • 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:

  1. πŸ—£ octocat commented on review for PR octocat/Hello-World#56: β€œNit: rename this variable…”

push

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].message or payload.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:

  1. πŸš€ octocat pushed 3 commits to octocat/Hello-World@main: β€œFix typo in docs…”

release

  • 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 – true if prerelease πŸ…ΏοΈ
    • actor – Who released πŸ‘€
    • ...
  • Example Template:

    "release": "{{index}}. πŸ“‘ Released [{{repo}}@{{payload.release.tag_name}}]({{payload.release.html_url}})"
  • Rendered Output:

  1. πŸ“‘ Released octocat/[email protected]

fork

  • 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:

  1. 🍴 Forked octocat/Hello-World to octocat/Hello-World-Fork

public

  • 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:

  1. 🎸 Made octocat/Hello-World public

About

README Workflow recent actions on GitHub stylish display

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •