-
Notifications
You must be signed in to change notification settings - Fork 166
Show any invalid entries in changelog #6031
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
Merged
mitchellhenke
merged 7 commits into
main
from
mitchellhenke/also-show-invalid-changelog-entries
Mar 23, 2022
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c40ec4c
Show any invalid entries in changelog
09405b2
rename changelog check file
9b6e3ea
slight refactor
f6f38de
add changelog check spec
13e5a8c
Drop capitalize on the change field
bf9e8c6
Update scripts/changelog_check.rb
806ba4b
add spec for capitalization
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| squashed_commit_with_one_commit: | ||
| commit_log: | | ||
| title: Upgrade Rails to 6.1.4.7 (#6041) | ||
| body:changelog: Internal, Security, Upgrade Rails to patch vulnerability | ||
| DELIMITER | ||
| title: 'Upgrade Rails to 6.1.4.7 (#6041)' | ||
| commit_messages: | ||
| - 'changelog: Internal, Security, Upgrade Rails to patch vulnerability' | ||
| category: 'Internal' | ||
| subcategory: 'Security' | ||
| change: 'Upgrade Rails to patch vulnerability' | ||
| pr_number: '6041' | ||
| squashed_commit_with_duplicate_pr: | ||
| commit_log: | | ||
| title: Upgrade Rails to 6.1.4.8 (#6042) | ||
| body:changelog: Internal, Security, Upgrade Rails to patch vulnerability | ||
| DELIMITER | ||
| title: 'Upgrade Rails to 6.1.4.8 (#6042)' | ||
| commit_messages: | ||
| - 'changelog: Internal, Security, Upgrade Rails to patch vulnerability' | ||
| category: 'Internal' | ||
| subcategory: 'Security' | ||
| change: 'Upgrade Rails to patch vulnerability' | ||
| pr_number: '6042' | ||
| squashed_commit_with_multiple_commits: | ||
| commit_log: | | ||
| title: LG-5515: update platform auth (#5976) | ||
| body:* add check to see if platform is available | ||
|
|
||
| * add alert | ||
|
|
||
| * changelog: Improvements, Webauthn, Provide better error flow for users who may not be able to leverage webauthn (LG-5515) | ||
|
|
||
| * fix linting, debug | ||
| Co-authored-by: Jessica Dembe <jessica.dembe@gsa.gov> | ||
| Co-authored-by: Zach Margolis <zachary.margolis@gsa.gov> | ||
| DELIMITER | ||
| title: 'LG-5515: update platform auth (#5976)' | ||
| commit_messages: | ||
| - '* add check to see if platform is available' | ||
| - '* add alert' | ||
| - '* changelog: Improvements, Webauthn, Provide better error flow for users who may not be able to leverage webauthn (LG-5515)' | ||
| - '* fix linting, debug' | ||
| - 'Co-authored-by: Jessica Dembe <jessica.dembe@gsa.gov>' | ||
| - 'Co-authored-by: Zach Margolis <zachary.margolis@gsa.gov>' | ||
| category: 'Improvements' | ||
| subcategory: 'Webauthn' | ||
| change: 'Provide better error flow for users who may not be able to leverage webauthn (LG-5515)' | ||
| pr_number: '5976' | ||
| squashed_commit_with_skip: | ||
| commit_log: | | ||
| title: Add LOGIN_TASK_LOG_LEVEL env var (#6037) | ||
| body:- Lets us set log level to minimize STDOUT output | ||
| from Identity::Hostdata (downloading files from S3, etc) | ||
|
|
||
| [skip changelog] | ||
| DELIMITER | ||
| title: 'Add LOGIN_TASK_LOG_LEVEL env var (#6037)' | ||
| commit_messages: | ||
| - '- Lets us set log level to minimize STDOUT output' | ||
| - ' from Identity::Hostdata (downloading files from S3, etc)' | ||
| - '[skip changelog]' | ||
| squashed_commit_invalid: | ||
| commit_log: | | ||
| title: LG-5629 account buttons part 2 (#5945) | ||
| body: | ||
| DELIMITER | ||
| title: 'LG-5629 account buttons part 2 (#5945)' | ||
| commit_messages: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| require 'rails_helper' | ||
| require_relative '../../scripts/changelog_check' | ||
|
|
||
| RSpec.describe 'scripts/changelog_check' do | ||
| git_fixtures = YAML.safe_load(File.read(File.expand_path('spec/fixtures/git_log_changelog.yml'))) | ||
|
|
||
| describe '#build_changelog' do | ||
| it 'builds a git log into structured changelog objects' do | ||
| git_log = git_fixtures.values.pluck('commit_log').join("\n") | ||
| changelog_entries = generate_changelog(git_log) | ||
| expect(changelog_entries.length).to eq 3 | ||
| fixture_and_changelog = git_fixtures.values.filter do |x| | ||
| x['category'].present? | ||
| end.zip(changelog_entries) | ||
|
|
||
| fixture_and_changelog.each do |fixture, changelog| | ||
| expect(fixture['category']).to eq changelog.category | ||
| expect(fixture['subcategory']).to eq changelog.subcategory | ||
| expect(fixture['pr_number']).to eq changelog.pr_number | ||
| expect(fixture['change']).to eq changelog.change | ||
| end | ||
| end | ||
|
|
||
| it 'skips commits with [skip changelog]' do | ||
| commits = [ | ||
| git_fixtures['squashed_commit_with_one_commit'], | ||
| git_fixtures['squashed_commit_with_skip'], | ||
| ] | ||
| git_log = commits.pluck('commit_log').join("\n") | ||
| changelog = generate_changelog(git_log) | ||
| expect(changelog.length).to eq 1 | ||
|
|
||
| expect(commits.first['category']).to eq changelog.first.category | ||
| expect(commits.first['subcategory']).to eq changelog.first.subcategory | ||
| expect(commits.first['pr_number']).to eq changelog.first.pr_number | ||
| expect(commits.first['change']).to eq changelog.first.change | ||
| end | ||
| end | ||
|
|
||
| describe '#build_structured_git_log' do | ||
| it 'builds a git log into structured objects' do | ||
| git_fixtures.values.each do |commit_fixture| | ||
| commits = build_structured_git_log(commit_fixture['commit_log']) | ||
| expect(commits.length).to eq 1 | ||
| expect(commits.first.title).to eq commit_fixture['title'] | ||
| expect(commits.first.commit_messages).to eq commit_fixture['commit_messages'] | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#generate_invalid_changes' do | ||
| it 'returns changelog entries without a valid structure' do | ||
| commits = [ | ||
| git_fixtures['squashed_commit_invalid'], | ||
| git_fixtures['squashed_commit_with_one_commit'], | ||
| git_fixtures['squashed_commit_with_skip'], | ||
| ] | ||
| git_log = commits.pluck('commit_log').join("\n") | ||
| changes = generate_invalid_changes(git_log) | ||
|
|
||
| expect(changes.length).to eq 1 | ||
| expect(commits.first['title']).to eq changes.first | ||
| end | ||
| end | ||
|
|
||
| describe '#format_changelog' do | ||
| it 'returns changelog entries without a valid structure' do | ||
| commits = [ | ||
| git_fixtures['squashed_commit_invalid'], | ||
| git_fixtures['squashed_commit_with_one_commit'], | ||
| git_fixtures['squashed_commit_with_skip'], | ||
| git_fixtures['squashed_commit_with_duplicate_pr'], | ||
| git_fixtures['squashed_commit_with_multiple_commits'], | ||
| ] | ||
| git_log = commits.pluck('commit_log').join("\n") | ||
| changelogs = generate_changelog(git_log) | ||
| formatted_changelog = format_changelog(changelogs) | ||
|
|
||
| expect(formatted_changelog).to eq <<~CHANGELOG.chomp | ||
| ## Improvements | ||
| - Webauthn: Provide better error flow for users who may not be able to leverage webauthn (LG-5515) ([#5976](https://github.com/18F/identity-idp/pull/5976)) | ||
|
|
||
| ## Internal | ||
| - Security: Upgrade Rails to patch vulnerability ([#6041](https://github.com/18F/identity-idp/pull/6041), [#6042](https://github.com/18F/identity-idp/pull/6042)) | ||
| CHANGELOG | ||
| end | ||
| end | ||
|
|
||
| describe '#generate_changelog' do | ||
| it 'capitalizes subcategory and capitalizes first letter of change description' do | ||
| git_log = <<~COMMIT | ||
| title: Add LOGIN_TASK_LOG_LEVEL env var (#6037) | ||
| body:- Lets us set log level to minimize STDOUT output | ||
| from Identity::Hostdata (downloading files from S3, etc) | ||
|
|
||
| * changelog: Improvements, authentication, provide better authentication (LG-4515) | ||
| DELIMITER | ||
| COMMIT | ||
|
|
||
| changelogs = generate_changelog(git_log) | ||
|
|
||
| expect(changelogs.first.subcategory).to eq('Authentication') | ||
| expect(changelogs.first.change).to start_with('P') | ||
| end | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a fixture case for the uppercase formatting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a spec in 806ba4b