<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sofia Ma</title>
    <description>The latest articles on DEV Community by Sofia Ma (@sofiama).</description>
    <link>https://dev.to/sofiama</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F918166%2F076c1b19-08be-47f9-a6e2-1d7655901805.jpeg</url>
      <title>DEV Community: Sofia Ma</title>
      <link>https://dev.to/sofiama</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sofiama"/>
    <language>en</language>
    <item>
      <title>Automate Release Notes a.ka. Changelog with release please</title>
      <dc:creator>Sofia Ma</dc:creator>
      <pubDate>Tue, 30 Aug 2022 23:20:25 +0000</pubDate>
      <link>https://dev.to/sofiama/automate-release-notes-aka-changelog-gcn</link>
      <guid>https://dev.to/sofiama/automate-release-notes-aka-changelog-gcn</guid>
      <description>&lt;p&gt;Curious about what is being released into a project? &lt;/p&gt;

&lt;p&gt;&lt;a href="https://keepachangelog.com/en/1.0.0/"&gt;&lt;strong&gt;Keep a Changelog&lt;/strong&gt;&lt;/a&gt;, it keeps your audience up to date with the latest changes at a glance!&lt;/p&gt;

&lt;p&gt;And even better, automate the CHANGELOG.md each time a PR is merged into the base branch:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;by using &lt;a href="https://www.conventionalcommits.org/en/v1.0.0/"&gt;conventional commits&lt;/a&gt;, it creates a standard &lt;a href="https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type"&gt;type&lt;/a&gt; for having a commit message format: &lt;code&gt;type(optional scope): message&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;and adding &lt;a href="https://github.com/googleapis/release-please"&gt;release please&lt;/a&gt; to your repository as a &lt;a href="https://github.com/googleapis/release-please#github-action-recommended"&gt;github action&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to automate the Changelog
&lt;/h2&gt;

&lt;p&gt;1 - Create &lt;code&gt;.github/workflows/release-please.yml&lt;/code&gt; at the root of the repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir .github &amp;amp;&amp;amp; cd .github &amp;amp;&amp;amp; mkdir workflows &amp;amp;&amp;amp; cd workflows &amp;amp;&amp;amp; touch release-please.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2 - Modify the changes on &lt;code&gt;release-please.yml&lt;/code&gt; and choose the &lt;a href="https://github.com/google-github-actions/release-please-action#release-types-supported"&gt;release-type&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# release-please.yml
on:
  push:
    branches:
      - main
name: release-please
jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: google-github-actions/release-please-action@v3
        with:
          release-type: simple
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 - Add the commit message and merge the branch. Make sure to follow conventional commits.&lt;/p&gt;

&lt;p&gt;4 - Some changelog sections will not be displayed. To override the &lt;a href="https://git.io/JqCZL"&gt;default&lt;/a&gt;, update the release-please.yml with &lt;code&gt;changelog-types&lt;/code&gt; with the field &lt;code&gt;hidden:false&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# release-please.yml
...
        with:
          release-type: simple
          changelog-types: &amp;gt;
            [
              { "type": "build", "section": "Build System", "hidden": false },
              { "type": "ci", "section": "Continuous Integration", "hidden": false },
              { "type": "chore", "section": "Miscellaneous Chores", "hidden": false },
              { "type": "docs", "section": "Documentation", "hidden": false },
              { "type": "feat", "section": "Features", "hidden": false },
              { "type": "fix", "section": "Bug Fixes", "hidden": false },
              { "type": "perf", "section": "Performance Improvements", "hidden": false },
              { "type": "revert", "section": "Reverts", "hidden": false },
              { "type": "refactor", "section": "Code Refactoring", "hidden": false },
              { "type": "style", "section": "Styles", "hidden": false },
              { "type": "test", "section": "Tests", "hidden": false }
            ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5 - Configure &lt;a href="https://github.blog/changelog/2022-05-11-default-to-pr-titles-for-squash-merge-commit-messages/"&gt;default to PR title for squash and merge commits&lt;/a&gt; when merging a pull request&lt;/p&gt;

&lt;p&gt;6 - See the automated changelog PR - &lt;a href="https://github.com/sofiama/tutorial-release-please/pull/7"&gt;github link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3wqE_6Aa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdqh1sjwz3ahdr1rb4le.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3wqE_6Aa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdqh1sjwz3ahdr1rb4le.png" alt="automated changelog" width="880" height="659"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;Squash and merge&lt;/code&gt; PR in github will group the commits into one commit, displaying just one line with the &lt;code&gt;PR#&lt;/code&gt;. While not using the &lt;code&gt;Squash and merge&lt;/code&gt; PR, each commit will be listed on its own, as displayed under the section "Continuous Integration"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XGbcOliM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1um5ua1mkkhz3gca6coe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XGbcOliM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1um5ua1mkkhz3gca6coe.png" alt="Squash and merge" width="880" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The individual commit history of the PR can still be viewed by clicking the PR# in the CHANGELOG.MD&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2RUVZSah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st390m183blxzu7tokbw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2RUVZSah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/st390m183blxzu7tokbw.png" alt="PR commit history" width="880" height="506"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Release notes can also be &lt;a href="https://github.com/googleapis/release-please#how-can-i-fix-release-notes"&gt;overridden&lt;/a&gt; in the body of the PR with the changelog reflecting the changes&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zHZ7BLMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssuc3o5b9l2ir7683kjr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zHZ7BLMK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssuc3o5b9l2ir7683kjr.png" alt="override release notes" width="880" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rbBB8aK6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgliqcty70bxn9zf160h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rbBB8aK6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgliqcty70bxn9zf160h.png" alt="changelog reflecting changes" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Simplify merged PRs
&lt;/h2&gt;

&lt;p&gt;Configure merged PRs to keep a cleaner history in the base branch&lt;/p&gt;

&lt;p&gt;1 - Add a branch protection rule to &lt;a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule"&gt;require branches to be up to date before merging&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oQJZvjOK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sg3ljhwuwr9kngw98qih.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oQJZvjOK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sg3ljhwuwr9kngw98qih.png" alt="rebase branch" width="880" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2 - Use &lt;a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests"&gt;squash and merge commits on PRs&lt;/a&gt; to keep a cleaner commit history in the base branch&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IFCdyhGZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92x7vnmaqfuj1vh7ik43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFCdyhGZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/92x7vnmaqfuj1vh7ik43.png" alt="squash and merge branch" width="880" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3 - &lt;a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches"&gt;Delete branches automatically&lt;/a&gt; after a merge&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nD47c3bY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4t54hlefef89u5rbgan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nD47c3bY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k4t54hlefef89u5rbgan.png" alt="delete branch" width="880" height="133"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;The Github repo for this tutorial can be found &lt;a href="https://github.com/sofiama/tutorial-release-please"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
    </item>
  </channel>
</rss>
