DEV Community

loading...

This Week in Commits History (GitHub Action)

Ali Ahsan
・2 min read

My idea was to have something like Facebook's "On this day" or Snapchat's Memories from today and apply it to a repository. So I started working on this action "Week-History-Action." I figured doing it every day would be another daily spam, so I went along with doing it weekly.

This action gathers the commits applied to the repo every week and packages them in an email. Every Monday, at 7 AM, the cron job runs, leveraging GitHub's API; every commit from the current date until seven days from now in history gets collected.

So let's say your repository is two years old and today is Monday, 17th Sept 2020. The action will find commits from 17th Sept 2019 to 23rd Sept 2019 and 17th Sept 2018 to 23rd Sept 2018. All the commits fitting the timeframe will get sent to the interested users via email. For email, I'm using NodeMailer. Currently, the committer's name, email, and date are gleaned along with the commit message.

This action is still a work in progress. The initial goal was to complete it by 17th Sept 2020, the deadline of the GitHub Actions Hackathon on DEV.

Unfortunately, due to numerous reasons, this is not complete. I'm merely sharing here for some thoughts from the community. During the development, I realized this might not be a useful action, so I would like to know if someone is interested in developing this with me going forward. This is the repo for those who are interested:

This Week in Commits History

This action gathers the commits applied to the repo every week and packages them in an email. Every Monday, at 7 AM, the cron job runs, leveraging GitHub's API; every commit from the current date until seven days from now in history gets collected.

So let's say your repository is two years old and today is Monday, 17th Sept 2020. The action will find commits from 17th Sept 2019 to 23rd Sept 2019 and 17th Sept 2018 to 23rd Sept 2018. All the commits fitting the timeframe will get sent to the interested users via email. For email, I'm using NodeMailer. Currently, the committer's name, email, and date are gleaned along with the commit message.

This action is still a work in progress. The initial goal was to complete it by 17th Sept 2020, the deadline of the GitHub Actions Hackathon on DEV.

The features are incomplete that will be implemented in the coming days, to name a few:

  • The email template to send has to be crafted, it's currently rudimentary, and I had trouble setting up a nice HTML table.
  • Configurable options i.e, to limit the number of commits the user gets, if plentiful commits were made in a week might not be wise to send everyone in the mailbox. Also, a notion of "useful" commit would be beneficial so that only the most important commits are sent.
  • It's not runnable as of yet; I encounter this issue today:
! [remote rejected] main -> main (refusing to allow an OAuth App to create or update workflow `.github/workflows/main.yml` without `workflow` scope)

This also needs to be addressed.

Its a bummer I couldn't complete the action, but I'm glad I got to work on an action and understand what's going on behind the hook. (Lesson learned: Just start early from next time.)

Discussion (0)