Able to create branch when issue is opened or transited to certain state #1454
No description
  • Robin Shen changed title 3 years ago
    Previous Value Current Value
    Add function to create the branch when the issue is opened
    Able to create branch when issue is opened or transited to certain state
  • OneDev changed state to 'Closed' 3 years ago
    Previous Value Current Value
    Open
    Closed
  • OneDev commented 3 years ago

    State changed as code fixing the issue is committed (789c2cec2bc273cdf8882ff25e741108f26fc60b)

  • OneDev changed state to 'Released' 3 years ago
    Previous Value Current Value
    Closed
    Released
  • OneDev commented 3 years ago

    State changed as build #3927 is successful

  • Robin Shen commented 3 years ago

    This can now be achieved by creating a CI job running create branch step, with issue in state trigger, and branch name can be specified as issue-@issue_number@

  • Zak Siddiqui commented 4 months ago

    No. You need this.

    This is blocking us from moving away from GitLab.

    Gitlab (free edition) has a feature which automatically creates a branch and related pull request (or "merge request" as GitLab calls it).

    This means it takes us 5 seconds of "zero-brain" activity to do the following:

    1. Create a branch from an issue
    2. Create a merge request that is linked to the branch

    Finally, when the merge request is merged into the source branch, the issue is automatically closed.

    It's like magic.

    Here are the steps in GitLab

    Create a new Issue

    image.png

    The new issue has a button to create a merge request

    image_2.png

    Fields are automatically filled in by the system

    The source branch is automatically set to the default branch

    The branch name is automatically set to a clean git-friendly branch name based on the issue title

    image_3.png

    The merge request is created

    image_6.png

    Finally, we click on merge

    ((Optionally, the approver needs to approve the merge request before the merge button is enabled, depending on project settings)._

    image_7.png

    The issue has automatically been closed

    image_8.png

  • Zak Siddiqui changed state to 'Open' 4 months ago
    Previous Value Current Value
    Closed
    Open
  • Zak Siddiqui commented 4 months ago

    This can now be achieved by creating a CI job running create branch step, with issue in state trigger, and branch name can be specified as issue-@issue_number@

    I tried this but it's not seamless because I need to name the branch. I don't want the branch to be just a number, and I don't want to spend the time to name the branch.

    In GitLab, the branch name is automatically set to a clean git-friendly branch name based on the issue title, like 1260-hello-world in the example above.

  • Zak Siddiqui commented 4 months ago

    C'mon everyone, please vote on this!

  • Robin Shen commented 4 months ago

    With build OD-7156, it is possible to use @suggested_issue_branch@ as branch name of the create branch step. This variable will be replaced with value issue-<issue number>-<normalized issue title>. Additionally, if lite AI model is configured, the issue title will be normalized with help of LLM to generate shorter branch name, and works even for non English titles.

    As to auto-close issue when merge a pull request, make sure that the commit message contains issue fix info (such as fix #3: some description, or use conventional commit). This is much reliable than relying on pull request description, and the issue can also be associated with all commits related to it, even if PR is not used.

  • Robin Shen changed state to 'Closed' 4 months ago
    Previous Value Current Value
    Open
    Closed
  • Zak Siddiqui commented 3 months ago

    Using @suggested_issue_branch@ as the branch name does not work on OneDev 14.1.8 (self hosted).

    Neither does it work inside the issue text.

    What am I missing?

    image_9.png

  • Zak Siddiqui changed state to 'Open' 3 months ago
    Previous Value Current Value
    Closed
    Open
  • Zak Siddiqui commented 3 months ago

    Why is this difficult? Why can't I just open the issue and click a button Create Branch from inside the issue?

    @robin I've raised these concerns before and they haven't been adequately addressed. Even GitLab Community Edition clearly outperforms your suggestion. Can we give it proper consideration this time?

  • Zak Siddiqui commented 3 months ago

    @robin bear with me. I now understand that you are referring to using CI. It was not clear from your message.

    Let me experiment with this a little bit

  • Zak Siddiqui commented 3 months ago

    Getting closer......

    version: 46
    jobs:
    - name: Auto Create Issue Branch
      steps:
      - type: CreateBranchStep
        name: '@suggested_issue_branch@'
        branchName: '@suggested_issue_branch@'
        branchRevision: main
        condition: SUCCESSFUL
        optional: false
      triggers:
      - type: IssueInStateTrigger
        state: In Progress
      retryCondition: never
      maxRetries: 3
      retryDelay: 30
      timeout: 14400
    
  • Zak Siddiqui commented 3 months ago

    OH MY GOSH - I take everything back, I'm SO SORRY

    OneDev much more powerful than GitLab - it just takes some getting used to

  • Zak Siddiqui removed comment 3 months ago
  • Robin Shen commented 3 months ago

    No problem. I did not mention it clearly, as I assume we are discussing in context of creating branch step, which is part of CI/CD.

    The step to create pull request step is reasonable. However it will be triggered when a branch is updated, instead of issue state being transitioned, as OneDev only allows PR to be created when source branch has outstanding commits (like GitHub do).

  • Robin Shen changed state to 'Closed' 3 months ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
New Feature
Priority
Major
Assignee
Issue Votes (2)
Watchers (7)
Reference
OD-1454
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover