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 for calling towncrier from sub-directories not only from the repo root. #433

Closed
qequ opened this issue Sep 26, 2022 · 6 comments · Fixed by #601
Closed

Add support for calling towncrier from sub-directories not only from the repo root. #433

qequ opened this issue Sep 26, 2022 · 6 comments · Fixed by #601
Labels

Comments

@qequ
Copy link

qequ commented Sep 26, 2022

I have a repo that looks like this

repo_root/
    - sub_project/
         - changes/ 
         - towncrier.toml
    - other_project/

where I want to use towncrier only in the sub_project directory (changes is where the fragments are). I've been able to create the first fragment in the default branch but when adding a new fragment 1234.feature from a new branch and using the check command like

towncrier check --compare-with origin/main

this is what produces

Looking at these files:
----
1. /home/user/repo-root/sub_project/sub_project/changes/1234.feature
----
No new newsfragments found on this branch.

It has found the new fragment but doesn't recognize it as a new fragment. Also the directory that has checked
is sub_project/sub_project, which it doesn't exist.

@adiroiban
Copy link
Member

Hi, Thanks for the report.

Can you share the content of the towncrier configuration file.

Also, can you confirm the working directory from which you call the towncrier check command ?

Regards

@qequ
Copy link
Author

qequ commented Sep 26, 2022

@adiroiban

towncrier.toml

[tool.towncrier]
version = "0.9.0"
directory = "changes"

I've tried calling it from sub_project with towncrier check --compare-with origin/main

and from repo_root with towncrier check --compare-with origin/main --dir sub_project/.
In both cases it produces the same output that I posted previously.

@adiroiban
Copy link
Member

Thanks for the confirmation... it looks like a bug

But ... I don't think that we have documentation confirming that towncrier check can be executed from anywhere other than the repo's root, for sub-projectst... so ... I guess this is a missing feature.


But it might be just missing documentation and this workaround is good enough.

Try something like this in the root of the repo, with towncrier in the root of the repo

[tool.towncrier]
    package = "towncrier"
    directory = "sub_project/changes"

You can have separate multiple towncrier config files in root.

@qequ
Copy link
Author

qequ commented Sep 26, 2022

@adiroiban that worked thanks 👍 so if I have many sub projects in a repo I have to call towncrier differently with each toml in the main root. e.g. if there is sub_project_1 and sub_project_2 then I need towncrier_sub_project_1.toml and towncrier_sub_project_2.toml Then with the check command;

towncrier check --compare-with origin/main --config towncrier_sub_project_1.toml

Is it planned to add the feature for subprojects in the future?

@adiroiban
Copy link
Member

Is it planned to add the feature for subprojects in the future?

I would be happy to review a patch

I don't know anyone planning to work on such a feature.

towncrier is an open source project and anyone can send bugfixes or new features.

@adiroiban adiroiban changed the title BUG: towncrier can't find fragments in subdirectories Add support for calling towncrier for sub-directories not only from the repo root. Sep 26, 2022
@adiroiban adiroiban changed the title Add support for calling towncrier for sub-directories not only from the repo root. Add support for calling towncrier from sub-directories not only from the repo root. Sep 26, 2022
@adiroiban
Copy link
Member

I have updated the title of the issue to better describe what is missing .

Since this is not a documented feature, we can't really call it a bug.

It's just a missing feature.

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