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

prepare release only if at least one commit respects a certain regex #1274

Closed
MarcoIeni opened this issue Feb 14, 2024 · 8 comments · Fixed by #1278
Closed

prepare release only if at least one commit respects a certain regex #1274

MarcoIeni opened this issue Feb 14, 2024 · 8 comments · Fixed by #1278
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@MarcoIeni
Copy link
Owner

Motivations

It might be too noisy to raise PRs on every commit.
E.g. some people might not want to release the crate if the commits contain only chores.

Solution

We should have a release_commits field in the workspace section of the configuration.
In release-plz update and release-plz release-pr we should bump the version and update the changelog of the crate only if at least one of the commits matches that regex.

E.g., if I want to only release when there's a new feature I write `release_commits = "^feat:" in the config.

Please update the doc too.

Additional context

Requested here.

@MarcoIeni MarcoIeni added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 14, 2024
@isidzukuri
Copy link
Contributor

isidzukuri commented Feb 17, 2024

hi! can you help please with fast(yes/no) answer? is it a good place to match commits?

if next_version != current_version || !diff.registry_package_exists {

or, in this loop, but higher?

@MarcoIeni
Copy link
Owner Author

MarcoIeni commented Feb 17, 2024

I think that should be a good place, yes.
But I haven't tested it so I might be wrong!

Anyway I think it's a good place to start :)

Are you working on a pr? 🤩

@isidzukuri
Copy link
Contributor

Im not sure i will be able to finalize PR but i've tried to poke around. Feel free to use it if it makes sense #1278. Currently i'm feeling lack of automated tests. And i haven't tested it manually, must study documentation to understand how to do it properly.

However existing tests passed successfully except generate_schema::tests::schema_is_up_to_date. Some other are failing when updating .schema/latest.json:

changelog::release_plz_adds_changelog_on_new_project
changelog::release_plz_adds_custom_changelog
changelog::release_plz_releases_a_new_project
helpers::gitea::gitea_new::can_create_gitea_repository
release::release_plz_releases_a_new_project_with_custom_release_name
release::release_plz_releases_a_new_project_with_custom_tag_name

Perhaps im doing smtn wrong. Didn't have enough time to figure it out.

Would be glad to know if i moved in right direction 🕵️

@MarcoIeni
Copy link
Owner Author

To make schema_is_up_to_date test pass, just run cargo run -- generate-schema as explained in the comment of the test itself:

// If this test fails, run `cargo run -- generate-schema` to update the schema.

I have done it for you 👍

for the other tests, you need to run docker as explained here. 👍

@MarcoIeni
Copy link
Owner Author

I looked at the PR, looks good. I need to test it.
If you want to write an integration test in the meantime, you can take inspiration from this:
https://github.com/isidzukuri/release-plz/blob/1810d9df33ec87e12dc48b3acf9c32ddad4b9e39/crates/release_plz/tests/all/changelog.rs#L5

@isidzukuri
Copy link
Contributor

Thank you! 👍

I will try to write an integration test 🙊

@isidzukuri
Copy link
Contributor

@MarcoIeni i have an idea how to save time on responding to inattentive contributors 😄 , please take a look #1285

@MarcoIeni
Copy link
Owner Author

I added a small integration test myself because I wanted to merge this today. Thanks for your contribution ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants