Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Group by PR label #17

Closed
fregante opened this issue Sep 19, 2020 · 10 comments
Closed

Group by PR label #17

fregante opened this issue Sep 19, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@fregante
Copy link
Owner

This is probably not an easy feature, but it might make the release notes a little better.

What if it used some PR’s labels to group the commits?

with:
  labels:
    - breaking change
    - bug
    - enhancement
  1. Fetch the each commit’s PR’s labels
  2. Add commit to the first matching label (e.g. add it only to "breaking change" if it also has "bug")
  3. Append PR-less commits at the end, after a <hr> or \n\n
@fregante fregante added the enhancement New feature or request label Sep 19, 2020
@fregante
Copy link
Owner Author

fregante commented Sep 19, 2020

Example:

Before

  • Restore split-issue-pr-search-results (#3556)
  • Fix incorrect spacing in cleanup-repo-filelist-actions (#3570)
  • Keep more-dropdown on the right on non-responsive pages
  • Allow selecting files bottom to top in batch-mark-files-as-viewed (#3558)
  • Enable highlight-deleted-and-added-files-in-diffs on isCompare (#3555)
  • Faster highlight-collaborators-and-own-conversations (#3552)
  • Avoid unnecessary checkbox in global conversation pages
  • Add new-repo-disable-projects-and-wikis feature (#3539)
  • Move Security and Insights tabs to more-dropdown (#3547)

After

Bug

  • Restore split-issue-pr-search-results (#3556)
  • Fix incorrect spacing in cleanup-repo-filelist-actions (#3570)
  • Allow selecting files bottom to top in batch-mark-files-as-viewed (#3558)

Enhancement

  • Enable highlight-deleted-and-added-files-in-diffs on isCompare (#3555)
  • Faster highlight-collaborators-and-own-conversations (#3552)
  • Add new-repo-disable-projects-and-wikis feature (#3539)
  • Move Security and Insights tabs to more-dropdown (#3547)

  • Keep more-dropdown on the right on non-responsive pages
  • Avoid unnecessary checkbox in global conversation pages

@fregante
Copy link
Owner Author

Specifying titles:

with:
  labels:
    breaking change: Breaking changes
    bug: Bugs
    enhancement: Enhancements
    "-": Others

Excluding non-PR commits:

with:
  labels:
    bug: Bugs
    "-": false

@notlmn
Copy link
Collaborator

notlmn commented Sep 20, 2020

Not sure if everyone includes PR numbers in the merge commit title though (squash or otherwise).

Apart from that, this would be awesome, people also use major, minor, and patch too with this.

with:
  labels:
    major: Breaking Changes
    minor: Minor Changes
    patch: Patches

Not sure if we should still have exclude, well it's up-to the user anyway.

@notlmn
Copy link
Collaborator

notlmn commented Sep 20, 2020

Should exclude be handled by labels too?

@fregante
Copy link
Owner Author

Excluding by labels could be possible by having a symbol set to false, like in my last example: that was meant to be read as “take Bugs and discard any other commit without PR or without the Bug label”

I think tittle-based exclusion is still useful and flexible (since it works on non-PR commits)

If you want to exclude by label I’d prefer it as an additional exclude-labels property.

@notlmn
Copy link
Collaborator

notlmn commented Sep 20, 2020

I think tittle-based exclusion is still useful and flexible (since it works on non-PR commits)

That makes sense.

@notlmn
Copy link
Collaborator

notlmn commented Sep 22, 2020

image

This is going to be a problem, inputs can only be "string", "boolean", or "number", especially with core.getInput() using environment variables for passing around inputs.

https://github.com/actions/toolkit/blob/da34bfb74d2827749824ce21f0d3d74a412d7fbf/packages/core/src/core.ts#L69-L77

@fregante
Copy link
Owner Author

That makes it uglier, but still possible:

labels: 'bug,breaking change'

However the object would have to be valid JSON: 🤢

labels: '{"bug":"Bugs","breaking change":"Breaking changes"}'

@notlmn
Copy link
Collaborator

notlmn commented Sep 23, 2020

Does this work?

labels: |
	{
		"bug": "Bugs",
		"breaking change": "Breaking changes"
	}

Or something similar?

Sheesh, JSON inside YAML looks weird as hell!

@fregante
Copy link
Owner Author

fregante commented Oct 8, 2020

I found a less ugly way:

labels: |
  bug: Bugs
  breaking change: Breaking changes

It's relatively easy if you don't need to support quotes:

labels.split(/\n/).map(line => line.split(/\s*:\s*/));
// -> [['bug', 'Bugs'], ['breaking change': 'Breaking changes']
// TODO: minimal validation of input so it doesn't silently ignore errors

Alternatively it can still support JSON for more complex requirements 👌

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants