Skip to content

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Aug 23, 2025

This PR adds a GitHub Actions workflow that automatically creates releases when module tags are pushed to the repository.

Features

  • Triggers on module tags: Responds to tags matching release/<namespace>/<module>/v*.*.* pattern
  • Module-specific changelogs: Filters changelog to show only changes affecting the specific module
  • Smart PR detection: Extracts PR numbers from commit messages in various formats
  • GitHub username resolution: Attempts to resolve GitHub usernames from commits using multiple methods
  • Automated release creation: Creates GitHub releases with proper titles and formatted changelogs

Example Usage

When you push a tag like release/coder-labs/sourcegraph-amp/v1.0.1, the workflow will:

  1. Extract the namespace (coder-labs), module (sourcegraph-amp), and version (v1.0.1)
  2. Find the previous tag for that specific module (e.g., release/coder-labs/sourcegraph-amp/v1.0.0)
  3. Generate a changelog showing only commits that affected registry/coder-labs/modules/sourcegraph-amp/
  4. Create a GitHub release titled "coder-labs/sourcegraph-amp v1.0.1" with the filtered changelog

Changelog Format

The generated changelog will look like:

## What's Changed

* fix: update Sourcegraph AMP source URL by @matifali in https://github.com/coder/registry/pull/370

**Full Changelog**: https://github.com/coder/registry/compare/release/coder-labs/sourcegraph-amp/v1.0.0...release/coder-labs/sourcegraph-amp/v1.0.1

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.

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]>
Copy link
Contributor Author

blink-so bot commented Aug 23, 2025

The CI failure is unrelated to this PR - it's a network/SSL issue in the cursor-cli module test where the Cursor installer can't connect to cursor.com:443:

curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to cursor.com:443

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.

blink-so bot and others added 2 commits August 23, 2025 19:48
- 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]>
@matifali matifali changed the title feat: add automated release workflow for module tags chore: add automated release workflow for module tags Aug 23, 2025
blink-so bot and others added 4 commits August 23, 2025 19:53
- 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]>
@matifali matifali marked this pull request as ready for review August 23, 2025 20:28
@Copilot Copilot AI review requested due to automatic review settings August 23, 2025 20:28
Copy link
Contributor

@Copilot Copilot AI left a 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.

Comment on lines +94 to +95
AUTHOR=$(gh api repos/:owner/:repo/commits/$sha --jq '.author.login // .commit.author.name')
FILTERED_CHANGELOG="${FILTERED_CHANGELOG}* $COMMIT_MSG by @$AUTHOR\n"
Copy link
Preview

Copilot AI Aug 23, 2025

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.

Suggested change
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.

@matifali matifali merged commit b206a68 into main Aug 23, 2025
4 checks passed
@matifali matifali deleted the blink/add-release-workflow branch August 23, 2025 20:29
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.

1 participant