Skip to content

Release Drafter: Automatically replace GitHub handles with real names and links #2775

Closed

Description

@seisman

Currently, the Release Drafter shows the contributors as a comma-separated list of GitHub handles, e.g., https://github.com/GenericMappingTools/pygmt/releases:

image

When we make a release, we prefer to have a bulleted list with contributors' real names and links, like:

image

So we have to make the conversions manually which is tedious.

The Release Drafter provides the replacers option, which can search and replace content in the generated changelog body. I think we can use this option to automatically replace GitHun handles with real names and links. This can be done by adding something like below to the .github/release-drafter.yml file:

replacers:
  - search: '@seisman'
    replace: '[Dongdong Tian](https://github.com/seisman)'

Activity

  1. changed the title [-]Release Drafter: Automatically replace GitHub handlers with real names and links[/-] [+]Release Drafter: Automatically replace GitHub handles with real names and links[/+] on Oct 29, 2023
  2. added
    question
    maintenance
    on Oct 29, 2023
  3. yvonnefroehlich commented on Oct 29, 2023

    @yvonnefroehlich
    Member

    Then we only have to convert the comma separated list to a bullet point list, correct?

  4. seisman commented on Oct 29, 2023

    @seisman
    MemberAuthor

    Then we only have to convert the comma separated list to a bullet point list, correct?

    Yes, we also need to do the handle-name conversion manually for new contributors.

  5. weiji14 commented on Oct 29, 2023

    @weiji14
    Member

    Could we try:

    replacers:

    i.e. add the hyphen (for making a markdown list) and a newline character at the end?

    Yes, we also need to do the handle-name conversion manually for new contributors.

    The search seems to work with regex too, so we could potentially set up something like:

    replacers:
      - search: `@(.+)`
        replace: '- [Name](https://github.com/$1)\n' 
    

    But the name will still need to be manually copied. Still, saves us from having to maintain a list of contributors.

    P.S. Test the regex statement at https://regex101.com/r/CV1Am0/1

  6. seisman commented on Oct 30, 2023

    @seisman
    MemberAuthor

    The search seems to work with regex too, so we could potentially set up something like:

    replacers:
      - search: `@(.+)`
        replace: '- [Name](https://github.com/$1)\n' 
    

    Release-drafter produces a list like this:

    @maxrjones, @michaelgrund, @seisman, @weiji14 and @yvonnefroehlich
    

    so the above search-replace won't work.

    The following regex works (https://regex101.com/r/IfV49k/1):

    replaces:
    -  search: '@(\w+)(,\s| and )?'
       replace: '- [@$1](https://github.com/$1)\n'
    

    It converts the comma-separated list to:

    - [@maxrjones](https://github.com/maxrjones)
    - [@michaelgrund](https://github.com/michaelgrund)
    - [@seisman](https://github.com/seisman)
    - [@weiji14](https://github.com/weiji14)
    - [@yvonnefroehlich](https://github.com/yvonnefroehlich)
    

    The replacers documentation says:

    Each replacer is applied in order.

    So, we can have:

    replaces:
    -  search: '@(\w+)(,\s| and )?'
       replace: '- [@$1](https://github.com/$1)\n'
    -  search: '@seisman'
       replace: 'Dongdong Tian'
    
  7. removed
    question
    on Oct 30, 2023
  8. added this to the 0.11.0 milestone on Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenance

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions