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

Consider modifying an existing NEWS fragments as acceptable #35

Open
pradyunsg opened this issue Mar 22, 2023 · 8 comments
Open

Consider modifying an existing NEWS fragments as acceptable #35

pradyunsg opened this issue Mar 22, 2023 · 8 comments
Labels
enhancement New feature or request feedback

Comments

@pradyunsg
Copy link
Collaborator

pradyunsg commented Mar 22, 2023

See pypa/pip#11879, which modifies a news/ fragment and thus does the correct effect on the changelog.

Fund with Polar
@webknjaz
Copy link
Member

@pradyunsg does skip news address this need?
There's similar logic in place for "release PRs" but it checks for "fragments removed + target rendered changelog has lines added".

I'm not sure that "an old change note modified" is an equally acceptable marker of a change note presence in a PR.

Though, this could probably be hidden behind a toggle.

I just want to make sure that a generic solution we'd come up with is acceptable for other end-users, not just pip. WDYT? Any ideas?

@webknjaz webknjaz added enhancement New feature or request feedback labels Mar 22, 2023
@pradyunsg
Copy link
Collaborator Author

pradyunsg commented Mar 27, 2023

I think it's good to consider "modifed an existing changelog file" to be a reason to consider this check to be a success. It's the behaviour of towncrier check --compare-with origin/${{ github.base_ref }} FWIW.

If we do decide to add a toggle for this, I don't have a strong sentiment toward what the default of that toggle should be -- either option works.

@webknjaz
Copy link
Member

Well, the default would be the current status quo so that it doesn't break existing users...

@webknjaz
Copy link
Member

It's the behaviour of towncrier check --compare-with origin/${{ github.base_ref }} FWIW.

This wasn't what browntruck implemented, though. Hence the current behavior.

@pradyunsg
Copy link
Collaborator Author

@pradyunsg
Copy link
Collaborator Author

IMO this entire section...

news_fragments_added = [
f for f in diff
if f.is_added_file and _tc_fragment_re.search(f.path)
]
logger.info(
'News fragments are %s',
'present' if news_fragments_added
else 'absent',
)
if news_fragments_added:
labels_url = f'{pull_request["issue_url"]}/labels'
await gh_api.post(
labels_url,
preview_api_version='symmetra',
data={
'labels': [
LABEL_PROVIDED,
],
},
)
news_fragments_required = requires_changelog(
diff,
_tc_fragment_re,
repo_config.get('paths', {}),
towncrier_config=towncrier_config,
)
report_success = not news_fragments_required or news_fragments_added

can be replaced with...

news_fragments_added = [
    f for f in diff
    if _tc_fragment_re.search(f.path) and not f.is_removed_file
]
report_success = bool(news_fragments_added)

Although, I'd say news_fragments_changed rather than added. This also removes the complexity of needing to detect "is this a release PR".

@webknjaz
Copy link
Member

Ah... It looks like I was trying to address #8 with 981b4ef. I kinda like this heuristic as default. It's more accurate to me so I'd rather go with a feature flag.

@pradyunsg
Copy link
Collaborator Author

pradyunsg commented Mar 27, 2023

For the release PR case, I think you can check if the destination changelog file itself has been added/modified. If it has been, that's maybe also good-enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback
Projects
None yet
Development

No branches or pull requests

2 participants