File tree Expand file tree Collapse file tree 4 files changed +49
-7
lines changed
Expand file tree Collapse file tree 4 files changed +49
-7
lines changed Original file line number Diff line number Diff line change 11Gemfile.lock
22.idea
33profiles /* .yml
4+ .ruby-version
5+ .ruby-gemset
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ whitelist:
3131 - 100-sync_bz_link_from_redmine
3232 - 150-set_assignee_according_to_redmine
3333 - 200-set_column_according_to_redmine
34+ - 250-set_column_according_to_tags
3435 - 400-sync_bz_bugs_to_triage
3536
3637# you can further limit what tasks will not be executed by blacklist
@@ -71,6 +72,12 @@ configuration:
7172 # never move task to backlog automatically, once it's already in progress
7273 Backlog:
7374 column: ['Work in progress']
75+ 250-set_column_according_to_tags:
76+ map:
77+ waiting_on_contributor: 'Work in progress'
78+ needs_rebase: 'Work in progress'
79+ waiting_on_packaging: 'Blocked'
80+ blocked_by_another_pr: 'Blocked'
7481 400-sync_bz_bugs_to_triage:
7582 color: 'amber'
7683 tag: 'Triage'
Original file line number Diff line number Diff line change 4444
4545 name = kanboard_columns . sort { |a , b | map . keys . index ( a . first ) <=> map . keys . index ( b . first ) } . first . try ( :first )
4646
47- # name overrides based on task tags
48- # TODO following override would be good to make configurable
49- if name == 'Review' && ( task . tags . include? ( 'needs_rebase' ) || task . tags . include? ( 'waiting_on_contributor' ) )
50- logger . info 'Overriding new state to Work in progress because of tag needs_rebase or waiting_on_contributor'
51- name = 'Work in progress'
52- end
53-
5447 change_column = task . column_id != KanboardColumn . find_by_name ( task . project_id , name ) . id
5548 blockers = task_configuration [ 'blockers' ] [ name ] || { }
5649 blocked_by_tag = blockers [ 'tag' ] . kind_of? ( Array ) && task . tags . any? { |tag | blockers [ 'tag' ] . include? ( tag ) }
Original file line number Diff line number Diff line change 1+ # settings format
2+ # map:
3+ # mapping of kanboard tags to kanboard columns
4+ #
5+ # blockers:
6+ # we ca prevent moving to specific column by setting a blocker based on tag or current column, e.g. don't move task to
7+ # Review column if "needs_rebase" tag is set for the task, or don't move the task to Backlog if it's already in Work in progress
8+ task_configuration = {
9+ 'map' => { } ,
10+ } . merge ( task_configuration )
11+ map = task_configuration [ 'map' ]
12+
13+ project . current_tasks . each do |task |
14+ logger . info "Processing #{ task . title } "
15+
16+ next if task . tags . empty?
17+
18+ logger . info "... found #{ task . tags . size } tags"
19+
20+ kanboard_columns = task . tags . map do |tag |
21+ found = map [ tag ]
22+ logger . debug "Couldn't find column name for #{ tag } " if found . nil?
23+ found
24+ end
25+ kanboard_columns . compact!
26+
27+ next if kanboard_columns . empty?
28+
29+ logger . debug "Found following columns for this task: #{ kanboard_columns . join ( ', ' ) } "
30+ name = kanboard_columns . first
31+
32+ change_column = task . column_id != KanboardColumn . find_by_name ( task . project_id , name ) . id
33+
34+ if change_column
35+ logger . warn "Setting the column #{ name } for this task"
36+ task . move_to_column ( name )
37+ end
38+
39+ logger . debug "\n "
40+ end
You can’t perform that action at this time.
0 commit comments