mikepenz/release-changelog-builder-action

include current PR but not other open PRs

chicco785 opened this issue · 7 comments

We are using this action to automatically populate a change log file, that is then merged back to main once PR is merged.

This allows to approve also the generated change log as part of the PR (which may be convenient to spot that a bad naming is used in the PR).

To do so, we use the includeOpen option, but this option includes as well any other Open PR. Is there a way to include only the current open PR?

Thx

There is currently no way to only include the current open PR, given the action itself has no understanding of what's "current".

However you can possibly achieve this with other features offered by the action.

You can use the advanced rule feature to categorize PRs, with that you may move this particular open PR into a category, and exclude all others based on that rule.
Screenshot 2023-04-21 at 13 00 38

Another example if you want to filter by open PRs, the action sets a "magic" label for those. So you could have a category which requires to be open and also a custom label you define for that particular PR:

thanks for the advice. in my understanding your idea would anyhow require every time to tweak labels one by one for each open pr. what about adding an option include that support an array of values?
In this way, we could set the pr number from the action, and fetch it. This would also allow to include any arbitrary pr, in whatever complex logic you may compute externally to the action.

@chicco785 you should be almost able to achieve that one too using the rule.

The missing piece right now would be the use of PR number - which is not exposed at this time (but makes sense for such use-case) - https://github.com/mikepenz/release-changelog-builder-action/blob/develop/src/configuration.ts#L33-L43

it works on branches already for example

so, for each category, i would need two rules, one that states status = merged and one that states number = #myPR, correct?

to use the syntax:

    "rules": [
      {
        "pattern": "merged",
        "on_property": "status"
      },
      {
        "pattern": "number",
        "on_property": "myPR"
      }
    ]

hi @mikepenz sorry to stress :) is my guess correct? in case would you mind me opening a pull request to add pr number to the exposed values?

many thanks for your feedback

Yes please feel free to open a PR to allow the number to be used in the rules too.
(https://github.com/mikepenz/release-changelog-builder-action/blob/develop/src/pullRequests.ts#L8 which basically lists all possible fields)

Sorry was not available for the past days.