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

feat: Add --tag-filter-pattern flag. #44

Merged
merged 1 commit into from
Sep 23, 2019

Conversation

evanchaoli
Copy link
Contributor

What does this do / why do we need it?

Our project tags the git repo in many ways. Several CI pipeline will tag with different prefixes. But we only want to include certain tags in CHANGELOG.

How this PR fixes the problem?

This PR adds a flag --tag-filter-pattern. This flag specifies a regular expression and only matched tags will be included in change log.

What should your reviewer look out for in this PR?

Code change is tiny. No much special. The major change is in tag_reader.go.

Check lists

  • Test passed
  • Coding style (indentation, etc)

Additional Comments (if any)

NA

Which issue(s) does this PR fix?

fixes #43

@coveralls
Copy link

coveralls commented Jul 4, 2019

Pull Request Test Coverage Report for Build 125

  • 17 of 59 (28.81%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+5.006%) to 75.153%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/git-chglog/main.go 10 52 19.23%
Files with Coverage Reduction New Missed Lines %
cmd/git-chglog/main.go 2 67.86%
Totals Coverage Status
Change from base Build 111: 5.006%
Covered Lines: 1597
Relevant Lines: 2125

💛 - Coveralls

@evanchaoli evanchaoli force-pushed the tag-filter branch 4 times, most recently from 8f420dc to 3b70908 Compare July 4, 2019 07:48
@evanchaoli
Copy link
Contributor Author

evanchaoli commented Jul 4, 2019

Can anybody please help review and merge this PR? I have added two new tests to test my change, however the coverage still dropped 0.2% because I added a CLI flag, which is 7 lines added, but main.go has no test case.

@evanchaoli
Copy link
Contributor Author

@tsuyoshiwada Can you please review this?

@evanchaoli
Copy link
Contributor Author

In order to fix the dropped coverage rate, I had to add main_test.go and refactored main.go a little bit.

This flag specifies a regular expression and only matched tags will
be included in change log.

Closes git-chglog#43
@evanchaoli
Copy link
Contributor Author

@tsuyoshiwada Can you please help review this PR?

@alexanderwe
Copy link

alexanderwe commented Sep 15, 2019

I would really like to see this land. I want to git-chglog it one of my projects, but only want to include certain tags into the changelog.

@rivy
Copy link

rivy commented Sep 22, 2019

IMO, I think this might be better as a configuration option in config.yml instead of as a command line option.

Having both would work as well, but I think it's a fairly unchanging repository-specific configuration and would be better placed within config.yml.

Here's a quick patch which converts your PR into a config.yml option (see 80b6c3b).

@alexanderwe
Copy link

@rivy I agree that it would be neat to also have it as a config.ymloption.
But especially on CI/CD servers where I might want to exclude some tags based on certain conditions, a command line argument is more flexible IMO.
So both would be perfect, but I would not prefer to drop the CLI argument

@evanchaoli
Copy link
Contributor Author

@rivy Let me explain our use case a little bit. In our project, we have several CI/CD pipelines running for per-push, daily, weekly builds, each tag the repo with different tag prefixes. So that each pipeline needs to use different tag-prefix, but they share same config.yml option.

Actually, I have the other change, adding Jira integration. I thought to raise a PR for that change once this PR is merged, but looks like the owner of this repo is not responsive, I was thinking to clone and maintain my own fork in last week.

@wadackel
Copy link
Member

@evanchaoli @rivy @alexanderwe

I'm really sorry for the late response... 🙇

I agree to support only the CLI flag in this change.
I think that it is better to add a function that uses config.yml if necessary.

Copy link
Member

@wadackel wadackel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm terribly sorry late...

Thank you for perfect work 🙏

@wadackel wadackel merged commit 5a55d0f into git-chglog:master Sep 23, 2019
@wadackel
Copy link
Member

Released as 0.9.1.

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

Successfully merging this pull request may close these issues.

feat: Add an option to filter tags
5 participants