State transition when setting custom field (OD-1312)
Closed
Jerome St-Louis opened 1 year ago

How can we possibly automatically transition State to Closed when setting Status custom field to Done?

We would need an option to transition Open->Closed "When field "Status" is set to "Done"".

It is only possible to use one field for the boards ("Status" in our case), so we cannot have the "State:Closed" column. Therefore we added a "Done" Status value, with the objective to be able to drag to Close instead of opening the issue editor and clicking the Close button.

This column also allows to keep seeing the "Done" issues in the board for the current milestone.

Similarly, it doesn't seem possible to set "Status" to "Done" when clicking the "Close" button. Transition rules can remove fields, but not set them.

Robin Shen commented 1 year ago

Why you need a separate status field? Just define appropriate states and transit the state directly.

Jerome St-Louis commented 1 year ago

@robin Mainly because I could not understand how to make things transition states using the columns, because the Transition Rules only talk about buttons, not board colums!!

(as I mentioned in https://code.onedev.io/onedev/server/~issues/841#IssueComment-4620 )

I am changing things to use states instead now that I understand :) Thank you.

Jerome St-Louis commented 1 year ago

Related to this, is it possible to transition from e.g., "In Progress" -> "Review" when setting a Pull Request field to an opened pull request?

Robin Shen commented 1 year ago

Currently there is no mechanism to transit issue state based on value of custom field. For your case, you may add a rule to transit issues from In Progress to Review when a pull request is opened against the issue. There is no need to add a pull request custom field, and the workflow will be much fluent:

  1. For commit fixing an issue, add a line in commit message like this: fix issue #1315
  2. Push the commit to a branch in OneDev
  3. Create a pull request for above branch against main branch
  4. Now issues mentioned in step 1 will be marked as In Review

You can even add a separate rule to move related issues to Merged or some other custom state when that pull request is merged

Robin Shen changed state to 'Closed' 1 year ago
Previous Value Current Value
Open
Closed
Jerome St-Louis commented 1 year ago

One reason I use a custom field is to be able to easily go to the Pull Request from the issue, at a clear place on the side with the other custom fields.

Another reason I was hoping for this is to not rely on a particular message in the commits -- we use a different style of commit message using (#issueNumber) without 'fixes' before. If we say 'fix', we use the present tense 'Fixes issue #number', which is not in the list or simply 'Fixes #111'.

Another reason is for cases where a pull request was already opened before the issue was created (that I was also hoping issue #1314 would address) -- though I guess it doesn't make much sense to transition to review since it's already in review when creating it.

Anyways, I added a 'Review' button and the button prompts for the Pull Request custom field.

Robin Shen commented 1 year ago

One reason I use a custom field is to be able to easily go to the Pull Request from the issue, at a clear place on the side with the other custom fields.

Related pull requests will also show at issue page with suggested approach

Another reason I was hoping for this is to not rely on a particular message in the commits -- we use a different style of commit message using (#issueNumber) without 'fixes' before. If we say 'fix', we use the present tense 'Fixes issue #number', which is not in the list or simply 'Fixes #111'.

Fixing issues via commit message is standard way to associated issue with commits, and it has many benefits, such as furtuer associated with pull requests, builds, etc. And you can also check what have been changed to fix a particular issue.

Issues, builds, and pull requests can all be referenced via its number, so OneDev uses issue/build/pull request prefix

Jerome St-Louis commented 1 year ago

Related pull requests will also show at issue page with suggested approach

Do you mean in the middle of the comments? I like to have it at a clear / same place on the side:

issuePR_2.png

Fixing issues via commit message is standard way to associated issue with commits

Of course, but sometimes we have multiple commits implementing an issue, so no one commit "fixes" the issue. And we use a different message style: "component: (#issue number) Work that was done". So we have a button to transition to Review in these cases.

Fixing issues via commit message is standard way to associated issue with commits

I figured that out, but it is not obvious for newcomers. It might be nice to add 'pr' as an abbreviation for 'pull request'.

Robin Shen commented 1 year ago

Related pull requests of an issue:

2023-04-07_07-28-07.png

I think it is still valueable to fix issues via commit message, and later you can squash them into one.

issue 1 of 1
Type
Improvement
Priority
Normal
Assignee
Issue Votes (0)
Watchers (4)
Reference
OD-1312
Please wait...
Page is in error, reload to recover