Conversation
Reviewer's GuideAdds a new manually-triggered GitHub Actions workflow to create date-based versioned releases, including logic to skip releases without meaningful changes and to generate deterministic tags by date, branch, and a daily counter. Sequence diagram for the manual date-based release workflowsequenceDiagram
actor Developer
participant GitHubUI
participant GitHubActions
participant ReleaseJob
participant GitRepo
participant GitHubReleases
Developer->>GitHubUI: Trigger workflow_dispatch
GitHubUI->>GitHubActions: Start Release workflow
GitHubActions->>ReleaseJob: Run job release
ReleaseJob->>GitRepo: Checkout repository (fetch-depth 0)
ReleaseJob->>GitRepo: Fetch tags
ReleaseJob->>ReleaseJob: Evaluate force_release input
alt force_release true
ReleaseJob->>GitHubActions: Set output skip=false
else force_release false
ReleaseJob->>GitRepo: Get last tag
alt no last tag
ReleaseJob->>GitHubActions: Set output skip=false
else last tag exists
ReleaseJob->>GitRepo: git diff LAST_TAG..HEAD
alt no file changes
ReleaseJob->>GitHubActions: Set output skip=true
else file changes exist
ReleaseJob->>ReleaseJob: Filter for meaningful changes
alt meaningful changes found
ReleaseJob->>GitHubActions: Set output skip=false
else no meaningful changes
ReleaseJob->>GitHubActions: Set output skip=true
end
end
end
end
opt skip is false
ReleaseJob->>GitRepo: Fetch tags for date prefix
ReleaseJob->>ReleaseJob: Compute date-based prefix
ReleaseJob->>ReleaseJob: Determine branch suffix
ReleaseJob->>GitRepo: List tags matching prefix
ReleaseJob->>ReleaseJob: Compute next daily counter
ReleaseJob->>GitHubActions: Output version tag
ReleaseJob->>GitHubReleases: gh release create version
GitHubReleases-->>ReleaseJob: Release and tag created
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The date-based versioning logic can suffer from race conditions if two releases are triggered for the same branch on the same day (both may compute the same NEXT_N before the tag exists remotely); consider adding a uniqueness guard (e.g., checking remote tags again just before creation or failing fast if the tag already exists).
- The "meaningful changes" filter uses a hardcoded exclusion list and comments referencing templates/apps that don’t appear in this repo; it might be clearer and safer to invert this to an explicit allowlist of paths that should trigger a release, aligned with this repository’s structure.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The date-based versioning logic can suffer from race conditions if two releases are triggered for the same branch on the same day (both may compute the same NEXT_N before the tag exists remotely); consider adding a uniqueness guard (e.g., checking remote tags again just before creation or failing fast if the tag already exists).
- The "meaningful changes" filter uses a hardcoded exclusion list and comments referencing templates/apps that don’t appear in this repo; it might be clearer and safer to invert this to an explicit allowlist of paths that should trigger a release, aligned with this repository’s structure.
## Individual Comments
### Comment 1
<location> `.github/workflows/release.yml:97-106` </location>
<code_context>
+ echo "Suffix: '$SUFFIX'"
+ echo "Regex: '$REGEX'"
+
+ MAX_N="-1"
+
+ # Get all tags for this "Minor" version (v1.YYYYMMDD.*)
+ TAGS=$(git tag -l "${PREFIX}*")
+
+ for tag in $TAGS; do
+ if [[ "$tag" =~ $REGEX ]]; then
+ # Strip suffix: v1.YYYYMMDD.N
+ base="${tag%$SUFFIX}"
+ # Extract Patch (N): Remove v1.YYYYMMDD.
+ n="${base#$PREFIX.}"
+
+ # Ensure n is numeric
+ if [[ "$n" =~ ^[0-9]+$ ]]; then
+ if (( n > MAX_N )); then
+ MAX_N=$n
+ fi
+ fi
+ fi
+ done
+
+ if [ "$MAX_N" == "-1" ]; then
+ NEXT_N=1
+ else
+ NEXT_N=$((MAX_N + 1))
+ fi
+
+ FINAL_VER="${PREFIX}.${NEXT_N}${SUFFIX}"
+
+ echo "Generated Version: $FINAL_VER"
</code_context>
<issue_to_address>
**issue (bug_risk):** Version calculation can race if multiple releases are triggered concurrently for the same branch/day.
Because `NEXT_N` is derived from `MAX_N + 1` after scanning existing tags, two concurrent runs (same `PREFIX`/`SUFFIX`) can both compute the same `NEXT_N` before either pushes its tag, leading to a tag collision or `gh release create` failure. If concurrent runs for the same branch are possible, consider adding coordination (e.g., verify tag doesn’t exist immediately before pushing and retry on conflict, or switch to a scheme that avoids tag scans, such as using the workflow run number).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| MAX_N="-1" | ||
|
|
||
| # Get all tags for this "Minor" version (v1.YYYYMMDD.*) | ||
| TAGS=$(git tag -l "${PREFIX}*") | ||
|
|
||
| for tag in $TAGS; do | ||
| if [[ "$tag" =~ $REGEX ]]; then | ||
| # Strip suffix: v1.YYYYMMDD.N | ||
| base="${tag%$SUFFIX}" | ||
| # Extract Patch (N): Remove v1.YYYYMMDD. |
There was a problem hiding this comment.
issue (bug_risk): Version calculation can race if multiple releases are triggered concurrently for the same branch/day.
Because NEXT_N is derived from MAX_N + 1 after scanning existing tags, two concurrent runs (same PREFIX/SUFFIX) can both compute the same NEXT_N before either pushes its tag, leading to a tag collision or gh release create failure. If concurrent runs for the same branch are possible, consider adding coordination (e.g., verify tag doesn’t exist immediately before pushing and retry on conflict, or switch to a scheme that avoids tag scans, such as using the workflow run number).
Pull request
Purpose
Describe the problem or feature in addition to a link to the issues.
Approach
How does this change address the problem?
Open Questions and Pre-Merge TODOs
Check all boxes as they are completed
Learning
Describe the research stage
Links to blog posts, patterns, libraries or addons used to solve this problem
Requirements
Check all boxes as they are completed
Summary by Sourcery
Add a manually triggered, date-based GitHub Actions workflow to create tagged releases when meaningful changes are detected.
New Features:
CI: