Automate your changelog and monthly product updates in your blog with AI
Tags: githubhack23, webdev, chatgpt
Published: 2023-05-23 07:56:53

## What I built 

The solution helps open-source maintainers to track changes in the product and tell the users about the updates.

### Category Submission: Maintainer Must-Haves

### App Link

[Blog with updates](https://changelog-automation.vercel.app/)

### Screenshots 

1. Changelog metadata is added automatically when a new Pull Request is created. ![Automatically added changelog metadata](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bmbrsstab1bdnbo58an.png)

2. A new version is added automatically when Pull Request is merged into the main branch. ![Automatically added version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ku4m6qgt5z5g45x4fjai.png)
 
3. New blog post is created based on the changelog history. ![Pull request with a new blog post](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ues571oaq99mpw7so41m.png)
 
4. Pull request merged, blog post is on [production](https://changelog-automation.vercel.app/2023_April/)! ![New blog post deployed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qpgyjmo84hojma3gh3ie.png)


### Description

Maintainers have never had enough time to handle all the issues with the projects. They have to play different roles when they work on open-source projects. While it is necessary to develop and test the product itself, and solve the issues opened by the users, the maintainers have to keep history of changes and notify everyone with updates. Moreover, we have a great writer for blog posts. His name is... Sure, ChatGPT!

I created a repository that demonstrates how GitHub Actions can help the maintainers to automate all the routines related to the Changelog of the project and create nice blog posts with AI telling the users what happened to the product for the last month.


### Link to Source Code 

[Source code](https://github.com/titovmx/changelog-automation)

### Permissive License

[MIT](https://github.com/titovmx/changelog-automation/blob/main/LICENSE)

## Background (What made you decide to build this particular app? What inspired you?) 

I would appreciate having such tools some time ago when I had been working on open-source projects with a small team. It is quickly getting clear that even if your project is awesome you have to find a way to tell the world about it and provide updated information to your existing users. However, developers spent most of the time on improvements and fixes. Besides, they need to provide clear and detailed documentation, handle user feedback, and not forget to test the solution before merging a breaking API change... So the communication to the users can be lost, they just would not know what and when you changed. A Changelog file helps the team and users follow all the changes, and blog posts are able to regularly deliver useful information to a large audience so everyone will stay in touch and you don't need anymore to ping every user to try your new features.

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?)

The demo assumes having a monorepo with the source of the main product, e.g. some awesome marketplace, a company blog with monthly product updates, and a set of GitHub actions.

The solution includes three parts:

I. When the developer creates Pull Request with a new awesome feature we want to verify that changes are added to the Changelog file. Changelog.md is located at the root of the project and contains a list of updates in the following format:

[version] [description] [date]

Besides, the newly opened PR adds metadata on the top of the Changelog using [Semantic Versioning](https://semver.org/) with a version level (MAJOR | MINOR | PATCH) and description. By default, it adds a new commit with a "PATCH" change so the maintainer could check and update the PR before the merge.

The workflow called `add-changelog-metadata` is responsible for it in the demo repository.

II. The next workflow called `add-changelog-version` will update changelog file after it is merged to the main branch, and transform metadata into the new version line. The previous version is increased by SemVer specification and the date of changes delivered to production is added.

III. The final workflow works by schedule and adds a new blog post written by AI. On the first day of a new month, the workflow takes the changes for the previous month, passes it to ChatGPT API, and returns his nice answer as a blog post content. The new PR would be created so the maintainer could look through it and add edits. A blog is built with Gatsby and hosted with Vercel [here](https://changelog-automation.vercel.app/) so right after the merge changes could be delivered to the website!

I've been very excited during this small project to play with these tools, deep dive into GitHub Actions API to find solutions for building these workflows and, of course, feel the power of the content created by AI.

### Additional Resources/Info

[Semantic Versioning](https://semver.org/)
[ChatGPT completion API](https://platform.openai.com/docs/guides/completion)
[Gatsby Starter Blog](https://www.gatsbyjs.com/starters/gatsbyjs/gatsby-starter-blog)
[Vercel](https://vercel.com)