-
Notifications
You must be signed in to change notification settings - Fork 55
chore: add automated release workflow for module tags #372
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
Conversation
Adds a GitHub Actions workflow that automatically creates releases when module tags are pushed. Features: - Triggers on release/<namespace>/<module>/v*.*.* tag pattern - Generates changelog filtered to only show changes for the specific module - Extracts PR numbers and GitHub usernames from commit messages - Creates GitHub release with proper title and changelog Example: pushing 'release/coder-labs/sourcegraph-amp/v1.0.1' will create a release with changelog showing only changes to the sourcegraph-amp module. Co-authored-by: matifali <[email protected]>
The CI failure is unrelated to this PR - it's a network/SSL issue in the
This is a transient infrastructure issue in the CI environment, not caused by the release workflow changes. The workflow file itself is valid and ready for review. |
- Add persist-credentials: false to checkout step to prevent credential leakage - Use environment variables instead of direct template expansion in shell commands - This prevents potential code injection attacks via malicious tag names Fixes identified by zizmor security scanner: - artipacked: credential persistence through GitHub Actions artifacts - template-injection: code injection via template expansion Co-authored-by: matifali <[email protected]>
Since there will be multiple releases for different modules, we shouldn't mark each one as the latest release. Co-authored-by: matifali <[email protected]>
- Use GitHub's built-in release notes generation API instead of manual parsing - Leverage GitHub CLI to get proper author information from commits - Reduce bash complexity by using GitHub's native features - Filter generated changelog to only include module-specific commits - Maintain same functionality with cleaner, more reliable code Co-authored-by: matifali <[email protected]>
Fixes the previous tag detection to find the actual chronologically previous version instead of just the latest non-current tag. Previous logic would incorrectly select newer versions as 'previous'. New logic properly finds the immediate predecessor in version order. Tested with real tags: - Current: release/coder-labs/sourcegraph-amp/v1.0.1 - Previous: release/coder-labs/sourcegraph-amp/v1.0.0 ✅ Co-authored-by: matifali <[email protected]>
Replaced complex array-based logic with a simple one-liner: git tag -l | sort -V | grep -B1 current_tag | head -1 Tested with multiple scenarios: - v0.9.0 -> (no previous) ✅ - v1.0.0 -> v0.9.0 ✅ - v1.0.1 -> v1.0.0 ✅ - v1.0.2 -> v1.0.1 ✅ - v1.1.0 -> v1.0.2 ✅ Maintains same functionality with much cleaner code. Co-authored-by: matifali <[email protected]>
- Removed full changelog link as requested - Cleaned up unnecessary comments that just describe what's happening - Kept workflow functionality intact Tested with multiple modules: - sourcegraph-amp: v1.0.1 -> v1.0.0 ✅ - claude-code: v2.1.0 -> v2.0.7 ✅ - vscode-web: v1.4.1 -> v1.4.0 ✅ - whizus/exoscale-zone: works across namespaces ✅ All tests pass with proper commit filtering and changelog generation. Co-authored-by: matifali <[email protected]>
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.
Pull Request Overview
This PR adds a GitHub Actions workflow to automatically create releases when module tags are pushed to the repository. The workflow filters changelogs to show only changes relevant to the specific module being released.
- Automated release creation for module-specific tags with pattern
release/<namespace>/<module>/v*.*.*
- Smart changelog generation that filters commits to only include changes affecting the specific module
- Integration with GitHub's release notes API to extract PR information and resolve usernames
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
AUTHOR=$(gh api repos/:owner/:repo/commits/$sha --jq '.author.login // .commit.author.name') | ||
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}* $COMMIT_MSG by @$AUTHOR\n" |
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.
If the author is resolved to a name (not a GitHub username), prefixing it with '@' will create an invalid GitHub mention. Only prefix with '@' when .author.login
is available, not when falling back to .commit.author.name
.
AUTHOR=$(gh api repos/:owner/:repo/commits/$sha --jq '.author.login // .commit.author.name') | |
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}* $COMMIT_MSG by @$AUTHOR\n" | |
AUTHOR_LOGIN=$(gh api repos/:owner/:repo/commits/$sha --jq '.author.login') | |
if [ -n "$AUTHOR_LOGIN" ]; then | |
AUTHOR_MENTION="@$AUTHOR_LOGIN" | |
else | |
AUTHOR_NAME=$(gh api repos/:owner/:repo/commits/$sha --jq '.commit.author.name') | |
AUTHOR_MENTION="$AUTHOR_NAME" | |
fi | |
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}* $COMMIT_MSG by $AUTHOR_MENTION\n" |
Copilot uses AI. Check for mistakes.
This PR adds a GitHub Actions workflow that automatically creates releases when module tags are pushed to the repository.
Features
release/<namespace>/<module>/v*.*.*
patternExample Usage
When you push a tag like
release/coder-labs/sourcegraph-amp/v1.0.1
, the workflow will:coder-labs
), module (sourcegraph-amp
), and version (v1.0.1
)release/coder-labs/sourcegraph-amp/v1.0.0
)registry/coder-labs/modules/sourcegraph-amp/
Changelog Format
The generated changelog will look like:
This ensures that each module's release only shows relevant changes, making it easier for users to understand what changed in their specific module.
Testing
The workflow has been tested with the existing tag pattern and module structure. It correctly parses tags, identifies module paths, and generates appropriate changelogs.