DEV Community

Josh Kasuboski
Josh Kasuboski

Posted on

1 1

Dev.to Article Stats GitHub Action

My Workflow

I made a GitHub Action that pulls stats from the Dev.to API. It currently just counts the total comments, page views, and reactions across all of your published articles.

I'm currently using the action to periodically collect the stats and save them in a repo under stats/dev-to.json.

Submission Category:

This is a Wacky Wildcard entry, but it's fun to collect stats 😉.

Yaml File or Link to Code

It's a Typescript Action. Creating it from the template was fairly straightforward. Figuring out how to run it locally was a little rough.

GitHub logo kasuboski / dev-to-stats-action

A GitHub Action to grab your Dev.to stats

dev.to stats-action status

Get the Article Stats from Dev.to

name: Get Stats
on:
  schedule:
    - cron: "*/30 * * * *"

jobs:
  pull-stats:
    runs-on: ubuntu-latest
    name: Get Stats from Dev.to
    steps:
    - uses: kasuboski/dev-to-stats-action@v1
      with:
        apiKey: ${{ secrets.API_KEY }}

You need to add a Dev.to API Key as a secret. You can find instructions to get one at dev.to.

The action will output a file at dev-to-stats/stats.json by default, but can be configured with the outFile input. The file should look something like below:

{"public_reactions_count":12,"page_views_count":123,"comments_count":0}

The repo where my stats are being aggregated.

GitHub logo kasuboski / stats

A collection of stats

stats 📈

A collection of stats pulled from other sources. Currently, it's just for Dev.to.

You can find the stats in the stats folder.






Additional Resources / Info

My workflow uses this action to push changed files back to the repo

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more