Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of generating machine-readable changelogs (YAML?) #253

Open
oleg-nenashev opened this issue Jul 3, 2019 · 6 comments
Open

Comments

@oleg-nenashev
Copy link
Contributor

As a maintainer, I would be interested to generate a machine-readable changelog in addition to user release notes.

Currently Release Drafter targets Markdown as a destination format. In the case of the Jenkins project, we maintain a machine readable changelog in YAML so that we can later generate https://jenkins.io/changelog/ and other data sources. Raw data: https://github.com/jenkins-infra/jenkins.io/blob/master/content/_data/changelogs/weekly.yml

Currently the changelog is generated using automation scripts, but it would be great to use Release Drafter.

What would I expect from YAML generation:

  • Being able to use replacer-alike approach to extract data from the message and to inject YAML fields
  • Simplified generation of the YAML output syntax

Workaround

I was able to hack a workaround using non-trivial replacers to extract issue numbers and to put them into YAML.

Configuration:

# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter
name-template: $NEXT_PATCH_VERSION
# Uses a more common 2-digit versioning in Jenkins weekly releases.
version-template: $MAJOR.$MINOR
tag-template: jenkins-$NEXT_MINOR_VERSION

# TODO: categories are YAGNI for now, until we can extract `type` somehow
exclude-labels:
  - reverted
  - no-changelog
  - skip-changelog
  - invalid
change-template: |-
  - type: todo
    message: |-
      $TITLE
    pull: $NUMBER
    authors:
      - $AUTHOR
template: |
  '''yaml
  $CHANGES
  '''
replacers:
  - search: '/\[*JENKINS-(\d+)\]*\s*-*\s*/g'
    replace: |-
      issue: $1
        message: |-
          
  - search: |-
      message: |-
          issue:
    replace: "issue:"

Generated output:

ReleaseDrafter_YAML

@toolmantim
Copy link
Collaborator

Another option would be to embed the data as a HTML comment in the release notes? Not sure if this is even possible, but just an idea.

@oleg-nenashev
Copy link
Contributor Author

Another option would be to embed the data as a HTML comment in the release notes? Not sure if this is even possible, but just an idea.

It would be possible, but in such case we would need to somehow have 2 sets of $CHANGES: one for Markdown and another one for the comment generation. It would be doable, but it would require adding a lot of advanced options in the configuration format

@TimonVS
Copy link
Member

TimonVS commented Jul 8, 2019

Would it make sense to attach this as a file to a release?

We might also want to think about how we can not make this part of the core of Release Drafter since this is a very specific request, I don't think many other users will have a need for this.

@oleg-nenashev
Copy link
Contributor Author

Yeah, I agree that it might be a niche case. Technically we could create a Jenkins-focused GitHub App which would extend release drafter and then see whether we could upstream some bits or generalize them to be a more generic app.

@oleg-nenashev
Copy link
Contributor Author

https://github.com/jenkinsci/jenkins/releases/tag/jenkins-2.190 for what I achieved so far with the standard Release Drafter. Not bad actually.

What is missing there:

  • Exposing the category name OR label to a variable so that change entries can be altered. This is the thing I wrongly put to Add $CATEGORIES as a template variable #139 comments, will create a separate issue
  • Indeed generation of the separate file, Mardown changelogs are much more readable than YAML. As @TimonVS said, it should be rather a separate extension.

@jasonkarns
Copy link

@oleg-nenashev there's also the changelog format proposed by https://keepachangelog.com/en/1.0.0/. It's still geared towards human consumption, but with a structured format, it could conceivably be machine parsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants