Skip to content

Conversation

@noopur23
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 12:38
@noopur23 noopur23 merged commit 701e8db into release Nov 12, 2025
4 checks passed
@noopur23 noopur23 deleted the docker-ci branch November 12, 2025 12:39
Copy link
Contributor

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 an automated GitHub release workflow that triggers when pull requests are merged to the release branch. The workflow extracts version and network information from PR labels and creates corresponding git tags.

  • Implements automatic git tag creation based on PR labels (version tags like "v1.0.0" and network tags like "devnet0", "testnet", "mainnet")
  • Validates that at least one usable label (version or network) is present before proceeding
  • Handles existing tags gracefully by skipping tag creation if they already exist

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fi

# Require at least one label (version or network)
if { [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; } && { [ -z "$ZEAM_TAG" ] || [ "$ZEAM_TAG" = "null" ]; }; then
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conditional check uses repetitive logic with multiple OR conditions that could be simplified. The expression { [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; } && { [ -z "$ZEAM_TAG" ] || [ "$ZEAM_TAG" = "null" ]; } is complex and harder to maintain.

Consider simplifying by using a function or combining the checks more cleanly:

if [ -z "$VERSION" ] && [ -z "$ZEAM_TAG" ]; then
  echo "❌ No usable label found! Please add a version (e.g. v1.0.0) or network tag (e.g. devnet0, testnet, mainnet)"
  exit 1
fi

Since jq already handles null values and would return empty string for non-matches, the "$VERSION" = "null" checks are redundant.

Suggested change
if { [ -z "$VERSION" ] || [ "$VERSION" = "null" ]; } && { [ -z "$ZEAM_TAG" ] || [ "$ZEAM_TAG" = "null" ]; }; then
if [ -z "$VERSION" ] && [ -z "$ZEAM_TAG" ]; then

Copilot uses AI. Check for mistakes.
git config user.email "github-actions[bot]@users.noreply.github.com"

# Create version tag if version label exists
if [ -n "${{ steps.get_tags_labels.outputs.version }}" ] && [ "${{ steps.get_tags_labels.outputs.version }}" != "null" ]; then
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The redundant null checks throughout the tag creation step are unnecessary. Since jq with the -r flag returns an empty string (not the literal string "null") when no match is found, checking for != "null" is redundant after already checking for non-empty with -n.

Simplify line 65 to:

if [ -n "${{ steps.get_tags_labels.outputs.version }}" ]; then

The same applies to the check on line 36 where || [ "$VERSION" = "null" ] can be removed.

Suggested change
if [ -n "${{ steps.get_tags_labels.outputs.version }}" ] && [ "${{ steps.get_tags_labels.outputs.version }}" != "null" ]; then
if [ -n "${{ steps.get_tags_labels.outputs.version }}" ]; then

Copilot uses AI. Check for mistakes.
echo "PR Labels: $LABELS"

# Look for version label (e.g., "v1.0.0", "version:1.0.0", etc.)
VERSION=$(echo $LABELS | jq -r '.[] | select(test("^(v|version:)?[0-9]+\\.[0-9]+\\.[0-9]+")) | gsub("^(v|version:)"; "")')
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex pattern has an issue with escaping. In the shell context, the backslashes need to be doubled or the string should be properly quoted. The current pattern "^(v|version:)?[0-9]+\\.[0-9]+\\.[0-9]+" may not work as intended because the backslashes before the dots might not be properly escaped for jq's regex engine.

Consider using:

VERSION=$(echo $LABELS | jq -r '.[] | select(test("^(v|version:)?[0-9]+\\.[0-9]+\\.[0-9]+$")) | gsub("^(v|version:)"; "")')

Also note that adding $ at the end of the pattern would ensure exact matching and prevent matching labels like "v1.0.0-beta".

Suggested change
VERSION=$(echo $LABELS | jq -r '.[] | select(test("^(v|version:)?[0-9]+\\.[0-9]+\\.[0-9]+")) | gsub("^(v|version:)"; "")')
VERSION=$(echo $LABELS | jq -r '.[] | select(test("^(v|version:)?[0-9]+\\\\.[0-9]+\\\\.[0-9]+$")) | gsub("^(v|version:)"; "")')

Copilot uses AI. Check for mistakes.
@noopur23 noopur23 restored the docker-ci branch November 12, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants