Skip to content
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

fix(tools): allow release branches to trigger release #348

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

naomi-lgbt
Copy link
Collaborator

@naomi-lgbt naomi-lgbt commented Nov 13, 2024

This gives us the ability to cut alpha/beta/custom releases via a release/ branch.

Summary by CodeRabbit

  • New Features
    • Expanded automated release process to include branches following the release/* naming convention.

Copy link

coderabbitai bot commented Nov 13, 2024

Walkthrough

The changes involve an update to the GitHub Actions workflow configuration file .github/workflows/release.yml. An additional branch trigger has been added to the release process, specifically allowing the workflow to be activated on pushes to branches that match the pattern release/*. This modification expands the automation capabilities for releases by including release/* as a prerelease branch in the semantic release configuration without altering the existing job structure or steps.

Changes

File Change Summary
.github/workflows/release.yml Added branch trigger release/* under on.push.branches and updated Create a release step to include release/* as a prerelease branch.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHub
    participant CI/CD

    Developer->>GitHub: Push to release/*
    GitHub->>CI/CD: Trigger release workflow
    CI/CD->>GitHub: Execute release process
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 71771f7 and b77a6d0.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
.github/workflows/release.yml (1)

11-11: Consider adding release branch cleanup

After a successful release, the release branch typically becomes obsolete. Consider adding a cleanup step to delete the branch after successful release.

Add this step after the release:

      - name: Delete release branch
        if: startsWith(github.ref, 'refs/heads/release/')
        run: |
          git push origin --delete ${GITHUB_REF#refs/heads/}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 18b4640 and 71771f7.

📒 Files selected for processing (1)
  • .github/workflows/release.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/release.yml (2)

Line range hint 1-39: Verify semantic-release configuration for release/ branches*

The workflow uses semantic-release which determines version numbers based on branch names. We should verify that the semantic-release configuration properly handles release/* branches to prevent version conflicts.

#!/bin/bash
# Description: Check semantic-release configuration
# Expected: Should show configuration that handles release/* branches

# Look for release.config.js or semantic-release configuration in package.json
fd -e js -e json -E node_modules -x cat {} \; | rg -A 10 'release\.config|semantic-release'

Consider documenting the following in your README or CONTRIBUTING guide:

  1. The naming convention for release branches (e.g., release/1.0.0-beta)
  2. How semantic-release determines versions from these branches
  3. The release workflow and when to use release branches vs. other branches

11-11: Verify branch protection rules for release/ pattern*

While adding support for release branches is valuable for flexible release management, it's crucial to ensure proper branch protection rules are in place to prevent unauthorized releases.

✅ Verification successful

No release/ branches found; branch protection rules are not applicable.*

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check branch protection rules for release/* pattern
# Expected: Should show branch protection rules that include release/* pattern

# Check branch protection rules
gh api repos/deepgram/deepgram-js-sdk/branches/release/protection 2>/dev/null || echo "No branch protection rule found for release/* pattern"

# List existing protected branches for reference
gh api repos/deepgram/deepgram-js-sdk/branches?protected=true

Length of output: 1443


Script:

#!/bin/bash
# Description: Check branch protection rules for all release/* branches
# Expected: Should list all release/* branches and indicate if they have protection rules

# Get all branches matching release/*
branches=$(gh api repos/deepgram/deepgram-js-sdk/branches | jq -r '.[] | select(.name | startswith("release/")) | .name')

if [ -z "$branches" ]; then
  echo "No branches match the release/* pattern."
  exit 0
fi

# Iterate over each release/* branch and check protection
for branch in $branches; do
  echo "Checking protection for branch: $branch"
  protection=$(gh api repos/deepgram/deepgram-js-sdk/branches/$branch/protection 2>/dev/null)
  if [ -z "$protection" ]; then
    echo "No branch protection rule found for $branch"
  else
    echo "Branch protection is enabled for $branch"
  fi
done

Length of output: 241

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.

2 participants