Fix the last_pr_sync setting during PR incoming processing
#1919
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.
Fix the
last_pr_syncsetting during PR incoming processingSummary
This PR fixes the
last_pr_synctimestamp logic in the changelog generator to use the version date instead of the current time when creating a new changelog entry.Files Changed
cmd/generate_changelog/internal/changelog/processing.golast_pr_synccache valueCode Changes
processing.goThe key change modifies how the
last_pr_synccache value is set after creating a new changelog entry:Before:
After:
Reason for Changes
The previous implementation used
time.Now()to set thelast_pr_synctimestamp, which is incorrect behavior. This could cause issues in scenarios where:By using
versionDateinstead, the sync timestamp accurately reflects the cutoff point for the version being processed, ensuring that subsequent runs will correctly fetch PRs merged after that version's date.Impact of Changes
Potential Bugs / Considerations
Assumption on
versionDate: This change assumesversionDateis always defined and valid at this point in the code. IfversionDatecould be zero-valued or nil, this could set an incorrect sync timestamp.Timezone handling: Ensure that
versionDateand any future PR timestamp comparisons use consistent timezone handling.Test Plan
last_pr_syncis set to the version date, not the current timeAdditional Notes
The updated comments clearly explain the reasoning behind using
versionDate, which improves code maintainability for future contributors.