Skip to content

chore: update docker-build workflow to remove main branch trigger #43

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

Merged
merged 7 commits into from
May 20, 2025

Conversation

cubxxw
Copy link
Member

@cubxxw cubxxw commented May 20, 2025

User description

This pull request makes a minor change to the .github/workflows/docker-build.yml file. The change removes the main branch from the list of branches that trigger the Docker build workflow on a push event.


Description

  • This PR enhances the Docker build workflow by removing the main branch trigger.
  • Builds will now focus on release-* branches and version tags only.

Changes walkthrough 📝

Relevant files
Configuration changes
docker-build.yml
Update Docker Build Workflow Branch Triggers                         

.github/workflows/docker-build.yml

  • Removed the main branch trigger from the Docker build workflow.
  • Updated the workflow to focus on release-* branches and version tags
    only.
  • +0/-1     

    💡 Penify usage:
    Comment /help on the PR to get a list of all available Penify tools and their descriptions

    Summary by CodeRabbit

    • Chores
      • Updated the workflow triggers for Docker build and push actions to run on pushes to release branches and specific tags, instead of the main branch.
      • Improved commit and push logic in client generation workflow by separating commit steps and using a bot token for authentication.
      • Changed backend test execution script to a new test starter script.
      • Updated default superuser password to enhance initial security.
      • Refined boolean conversion logic for more precise type handling in pre-start tests.
      • Adjusted frontend configuration for server actions to a new experimental setting format.

    - Removed the main branch trigger from the docker-build workflow, allowing builds to focus on release branches and version tags only.
    @cubxxw cubxxw requested a review from kubbot as a code owner May 20, 2025 03:55
    @github-project-automation github-project-automation bot moved this to Backlog in nexus May 20, 2025
    Copy link
    Contributor

    coderabbitai bot commented May 20, 2025

    Walkthrough

    The GitHub Actions workflows for Docker build and client generation were updated to refine trigger conditions and separate commit-and-push logic into distinct jobs using a bot token. The Makefile's backend test target was changed to run a different test script. The default superuser password in the backend config was updated. A type precision improvement was made in a boolean conversion fallback function. The Next.js config's experimental serverActions setting was changed from true to an empty object.

    Changes

    File(s) Change Summary
    .github/workflows/docker-build.yml Updated workflow triggers: removed main branch from push events; triggers now on release-* branches and tags matching v*.*.* and v*.*.*-*. Scheduled and other push triggers remain unchanged.
    .github/workflows/generate-client.yml Changed PR trigger to only on closed (merged) events; split commit-and-push logic into a new auto-commit-push job that runs after generate-client. Uses a bot token for git authentication and always commits (allowing empty commits) after rebasing.
    Makefile Changed backend-test target to run bash scripts/tests-start.sh instead of bash scripts/test.sh in the backend directory; suppressed command echoing with @.
    backend/app/core/config.py Updated default value of FIRST_SUPERUSER_PASSWORD from "admin" to "telepace".
    backend/app/tests_pre_start.py Added import of Literal from typing; changed fallback strtobool implementation to return Literal[0, 1] with explicit boolean conversion logic returning 1 or 0 instead of generic int.
    frontend/next.config.js Changed experimental.serverActions config option from boolean true to an empty object {}.

    Poem

    🐇
    The Docker build now hops anew,
    Not on main, but on tags in view.
    Only release-* will start the show,
    As versions blossom, the containers grow.
    The client’s push is split and bright,
    A bot commits with gentle might.
    A password changed, a test script swapped,
    In code’s garden, progress hopped!
    🚀

    Note

    ⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

    CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
    Learn more here.


    Note

    ⚡️ Faster reviews with caching

    CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
    Enjoy the performance boost—your workflow just got faster.


    📜 Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro
    Cache: Disabled due to data retention organization setting
    Knowledge Base: Disabled due to data retention organization setting

    📥 Commits

    Reviewing files that changed from the base of the PR and between fa2d4b5 and 786a251.

    📒 Files selected for processing (3)
    • .github/workflows/generate-client.yml (2 hunks)
    • Makefile (1 hunks)
    • frontend/next.config.js (1 hunks)
    ✅ Files skipped from review due to trivial changes (2)
    • frontend/next.config.js
    • Makefile
    🚧 Files skipped from review as they are similar to previous changes (1)
    • .github/workflows/generate-client.yml
    ✨ Finishing Touches
    • 📝 Generate Docstrings

    🪧 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.
      • Explain this complex logic.
      • 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 explain this code block.
      • @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 explain its main purpose.
      • @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.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    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 generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

    @penify-dev penify-dev bot added enhancement New feature or request Review effort [1-5]: 1 labels May 20, 2025
    Copy link
    Contributor

    penify-dev bot commented May 20, 2025

    PR Review 🔍

    ⏱️ Estimated effort to review [1-5]

    1, because the change is straightforward and involves a simple removal of a branch trigger in the workflow file.

    🧪 Relevant tests

    No

    ⚡ Possible issues

    No

    🔒 Security concerns

    No

    Copy link
    Contributor

    penify-dev bot commented May 20, 2025

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Maintainability
    Add a comment to clarify the reason for removing the main branch trigger

    Consider adding a comment explaining the removal of the main branch trigger to provide
    context for future maintainers.

    .github/workflows/docker-build.yml [8]

    -- main
    +# Removed main branch trigger to prevent builds on the main branch
     
    Suggestion importance[1-10]: 7

    Why: Adding a comment would improve maintainability by providing context for the change, but it does not address a critical issue in the code itself.

    7

    cubxxw added 3 commits May 20, 2025 12:18
    - Updated the commit logic to check for both staged and unstaged changes before committing, ensuring that only relevant changes are pushed.
    - Added a message for cases where no changes are detected after rebase, enhancing clarity in the workflow's output.
    …ed type safety
    
    - Updated the strtobool function to return a Literal[0, 1] instead of an int, ensuring better type clarity and consistency in return types.
    - This change improves the function's usability in type-annotated contexts.
    - Replaced the backend test command in the Makefile to use `tests-start.sh` for improved test execution.
    - Updated the default superuser password in the configuration file for enhanced security.
    Copy link

    gitguardian bot commented May 20, 2025

    ⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

    Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

    🔎 Detected hardcoded secret in your pull request
    GitGuardian id GitGuardian status Secret Commit Filename
    16943385 Triggered Generic Password bf29bdd backend/app/core/config.py View secret
    🛠 Guidelines to remediate hardcoded secrets
    1. Understand the implications of revoking this secret by investigating where it is used in your code.
    2. Replace and store your secret safely. Learn here the best practices.
    3. Revoke and rotate this secret.
    4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

    To avoid such incidents in the future consider


    🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

    Copy link
    Contributor

    @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: 2

    🧹 Nitpick comments (1)
    .github/workflows/generate-client.yml (1)

    91-99: Refactor push logic to reduce duplication and simplify diff checks

    You can DRY-up this block by:

    1. Extracting the branch name into a variable.
    2. Using a single diff-index check instead of two separate git diff calls.
    3. Moving the git push out of the inner condition to avoid repeating it.

    For example:

     run: |
    -  if ! git diff --staged --quiet; then
    -    echo "✅ Changes detected in generated client. Committing and pushing..."
    -    git pull --rebase origin ${{ github.head_ref || github.ref_name }}
    -    if ! git diff --quiet || ! git diff --staged --quiet; then
    -      git commit -a -m "ci: ✨ Autogenerate frontend client"
    -      git push origin HEAD:${{ github.head_ref || github.ref_name }}
    -    else
    -      echo "✅ No changes to commit after rebase."
    -      git push origin HEAD:${{ github.head_ref || github.ref_name }}
    -    fi
    -  else
    -    echo "✅ No changes detected in generated client."
    +  BRANCH="${{ github.head_ref || github.ref_name }}"
    +  if ! git diff-index --quiet HEAD --; then
    +    echo "✅ Changes detected in generated client. Rebasing…"
    +    git pull --rebase origin "$BRANCH"
    +    if ! git diff-index --quiet HEAD --; then
    +      git commit -a -m "ci: ✨ Autogenerate OpenAPI clients [skip ci]"
    +    else
    +      echo "✅ No changes to commit after rebase."
    +    fi
    +    git push origin HEAD:"$BRANCH"
    +  else
    +    echo "✅ No changes detected in generated client."
      fi

    This makes the logic clearer and concise.

    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro
    Cache: Disabled due to data retention organization setting
    Knowledge Base: Disabled due to data retention organization setting

    📥 Commits

    Reviewing files that changed from the base of the PR and between 0b6b7da and bf29bdd.

    📒 Files selected for processing (4)
    • .github/workflows/generate-client.yml (1 hunks)
    • Makefile (1 hunks)
    • backend/app/core/config.py (1 hunks)
    • backend/app/tests_pre_start.py (1 hunks)
    ✅ Files skipped from review due to trivial changes (2)
    • backend/app/tests_pre_start.py
    • backend/app/core/config.py
    ⏰ Context from checks skipped due to timeout of 90000ms (4)
    • GitHub Check: test-playwright (4, 4)
    • GitHub Check: test-playwright (1, 4)
    • GitHub Check: test-playwright (3, 4)
    • GitHub Check: test-playwright (2, 4)
    🔇 Additional comments (1)
    .github/workflows/generate-client.yml (1)

    103-105: Verify BOT_GITHUB_TOKEN configuration

    This step relies on:

    env:
      GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}

    Ensure that:

    • BOT_GITHUB_TOKEN is defined in your repo’s secrets.
    • It has contents: write permissions to push commits.

    Alternatively, you can use the built-in secrets.GITHUB_TOKEN, which is already granted contents: write by this workflow.

    cubxxw added 3 commits May 20, 2025 13:26
    - Modified the workflow to trigger on closed pull requests and pushes to the main branch.
    - Added a new job for auto-committing changes with a timestamped message, enhancing clarity in generated client updates.
    - Configured Git user settings for the auto-commit step to ensure proper authentication during pushes.
    - Changed the serverActions property from a boolean to an object in the Next.js configuration for improved flexibility and future extensibility.
    - Modified the commit message in the generate-client workflow to specify both frontend and admin clients, enhancing clarity in the auto-generated commit logs.
    - Added a [skip ci] tag to the commit message to prevent unnecessary CI runs for autogenerated commits.
    @cubxxw cubxxw merged commit ef83549 into main May 20, 2025
    2 of 5 checks passed
    @github-project-automation github-project-automation bot moved this from Backlog to Done in nexus May 20, 2025
    @cubxxw cubxxw deleted the feat/disign-base branch May 20, 2025 06:54
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    Status: Done
    Development

    Successfully merging this pull request may close these issues.

    1 participant