DEV Community

Cover image for Automated JIRA release notes
Patrick R
Patrick R

Posted on

Automated JIRA release notes

This is my submission to the #ActionsHackathon. It is a github action designed to generate release notes based on commit messages.

My Workflow

My tendency to get tunnel vision when working has often led me to lose track of events happening in my team. The number of projects and repos being large, keeping track of release cycles had me worried.

I built the patrixr/jira-release-notes action with the intent of being notified by email whenever one of our (many) apps got released.

It works as follows:

  • It compares two git refs and reads all the new commits (typically when a pull request is merged)
  • It finds JIRA ticket references in the commit messages (e.g ABC-123)
  • Using jira credentials, it will retrieve the ticket info
  • It will generate release notes in Markdown based on those tickets

The available outputs are:

  • PDF - The action will always generate a pdf file
  • Email - Optional - If provided with a Sendgrid key and recipients, will forward the notes via email

Submission Category:

  • DIY Deployments

Yaml File or Link to Code

For details, head over to the github repo:

GitHub logo patrixr / jira-release-notes

πŸ”€ Github action to generate release notes based on JIRA tickets

Jira Release Notes

This action generates release notes based on JIRA ticket numbers found in commits, and creates a PDF file. It can also email you the notes.

Built as part of the #ActionsHackathon

How it works

You need to provide 2 refs to the action, head and base. The action steps are as followed:

  1. Fetch all the commits between the head and base refs
  2. Find any reference to JIRA ticket numbers, based on the jira-code you provide
  3. Will fetch the ticket titles using the jira-host, jira-username and jira-password you provide
  4. If pdf is set to true 4.1. Will generate a pdf with the list of changed tickets, and output the file path under the pdf variable otherwise 4.2. Will generate markdown with the list of changed tickets, and output it under the markdown variable
  5. (OPTIONAL) If the email-to and sendgrid-api-key are provided, and email will be sent…

You can also find it on the Marketplace

Usage example

name: Forward release notes

on:
  pull_request:
    types: [closed]
    branches:
      - live

jobs:
  release-notes:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == true
    steps:
    - uses: actions/checkout@v2
    - name: Generate and email notes
      uses: actions/jira-release-notes@v1.0.1
      id: pdf_generator
      with:
        head: ${{github.event.pull_request.head.sha}}
        base: ${{github.event.pull_request.base.sha}}
        jira-code: 'ABC'
        jira-host: jira.mycompany.org
        jira-username: ${{secrets.jira_username}}
        jira-password: ${{secrets.jira_password}}
        email-to: 'john@mycompany.org,jane@mycompany.org'
        sendgrid-api-key: ${{secrets.sendgrid_api_key}}
        app-name: 'My Awesome Service'
        unshallow: true
    - name: Process the pdf
      run: echo "The generated pdf was ${{ steps.pdf_generator.outputs.pdf }}"

Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

We have been using this tool within the Goodcity Project, a system designed to gather, managed and distribute donations. The project lives under the umbrella of the non-profit Crossroads Foundation. Our work is available on github.

Ideas for improvement

  • Multiple email service support
  • Custom Markdown template for email/pdf structure
  • Support for other project management platforms

Feel free to reach out for any issue or suggestions :)

Happy coding everyone !

Cheers !

Top comments (0)