DEV Community

Jesse Piaścik
Jesse Piaścik

Posted on

How I automate my changelog with imdone!

I work full time as an advising consultant and software engineer, so I really need to automate a lot my work on imdone. For starters, I use imdone to plan and manage releases of imdone.

Being the first user of an imdone release allows me to try out new functionality to automate my workflow. In imdone 1.26, I introduced the ability to add .imdone/actions/card.js and .imdone/actions/board.js modules. This allows you to add board actions to the main menu in imdone.

board actions

This board action copies each card in the READY list as a markdown list, which you can paste into your changelog.

To add this menu option create a .imdone/actions/board.js file in your project and add the following.

module.exports = function () {
  const project = this.project
  return [
    {
      title: 'Copy changelog',
      action: function () {
        const lists = project.lists.filter((list) => list.name === 'READY')
        const cards = lists[0].tasks.map((task) => {
          const contentArray = task.description.map((line) =>
            line.replace(/^/, '  ')
          )
          contentArray.unshift(
            task.text.replace(/^\#*\s*/, '').replace(/^/, '- ')
          )
          return contentArray
            .filter((line) => !/^\s*- \[x\]/.test(line.trim()))
            .join('\n')
            .replace(/<!--.*-->/gs, '')
            .split('\n')
            .filter((line) => line.trim().length > 0)
            .join('\n')
        })

        project.copyToClipboard(cards.join('\n'), 'Changelog copied')
      },
    },
  ]
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)