afterlife 1.9.1 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d237f1804b7bd717dd3fb578ed2e7d9a820b43a8fb47098edb373e104e4e8cd3
|
|
4
|
+
data.tar.gz: 1cb0443f7297dd8ebc9cf9524f39364a9f855e4d9b35b8f47d1a0226995e90f2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 728bf6700229c7bbdb11415a83bc277ee4363f5079e8b160de63a80c9a95c35f1729fb640d2c7a86cc1a7cd13365c688afc7ca0458535ec780dbd2769986e06e
|
|
7
|
+
data.tar.gz: 482cdf49525924556b0b04bb32903e64af39c408e7dbccdb05d5af5891d4e9eaa2c8887ae341c53bf360ec13bd336f5447b2f1d9205b99c3597d2ee755324c45
|
|
@@ -6,7 +6,7 @@ module Afterlife
|
|
|
6
6
|
module Clickup
|
|
7
7
|
class Api
|
|
8
8
|
BASE_URL = 'https://api.clickup.com'
|
|
9
|
-
attr_reader :connection
|
|
9
|
+
attr_reader :connection, :last_update_error
|
|
10
10
|
|
|
11
11
|
def initialize(token:)
|
|
12
12
|
@connection = Faraday.new(
|
|
@@ -26,8 +26,10 @@ module Afterlife
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def update_task(task_id, params)
|
|
29
|
+
@last_update_error = nil
|
|
29
30
|
connection.put("/api/v2/task/#{task_id}", params).body
|
|
30
31
|
rescue Faraday::Error => e
|
|
32
|
+
@last_update_error = e.message
|
|
31
33
|
puts "Error updating task #{task_id}: #{e.message}"
|
|
32
34
|
nil
|
|
33
35
|
end
|
|
@@ -8,6 +8,8 @@ module Afterlife
|
|
|
8
8
|
/#CU_([a-z0-9]+)/i,
|
|
9
9
|
/#([a-z0-9]{8,})/i,
|
|
10
10
|
/CU-([a-z0-9]+)/i,
|
|
11
|
+
/\bClickUp task\s+((?=[a-z0-9]*\d)[a-z0-9]{8,})\b/i,
|
|
12
|
+
%r{\bhttps://app\.clickup\.com/t/(?:\d+/)?((?=[a-z0-9]*\d)[a-z0-9]{8,})\b}i,
|
|
11
13
|
].freeze
|
|
12
14
|
|
|
13
15
|
def self.call(text, convert_to_link = false)
|
|
@@ -23,6 +23,8 @@ module Afterlife
|
|
|
23
23
|
|
|
24
24
|
def revert_count(line, task_id)
|
|
25
25
|
before_task_id = line.split(/#?(?:CU[-_])?#{Regexp.escape(task_id)}/i, 2).first
|
|
26
|
+
return 0 unless line[before_task_id.length..].include?('"')
|
|
27
|
+
|
|
26
28
|
before_task_id.scan(/\brevert\b/i).count
|
|
27
29
|
end
|
|
28
30
|
end
|
|
@@ -24,10 +24,8 @@ module Afterlife
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def call(task_ids, target_status) # rubocop:disable Metrics/AbcSize
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return []
|
|
30
|
-
end
|
|
27
|
+
@skipped_tasks = []
|
|
28
|
+
log 'No tasks to update' if task_ids.empty?
|
|
31
29
|
|
|
32
30
|
log 'WARNING: Forcing status updates...' if force
|
|
33
31
|
log 'WARNING: Dry run, no tasks will be updated' if dry_run
|
|
@@ -38,6 +36,9 @@ module Afterlife
|
|
|
38
36
|
cherry_pick_status = " - Cherry Pick: #{task[:is_cherry_pick] ? '✅' : '❌'}" if cherry_pick
|
|
39
37
|
log "- #{task[:link]} (from '#{task[:previous_status]}' to '#{task[:new_status]}')#{cherry_pick_status}"
|
|
40
38
|
end
|
|
39
|
+
summary = "#{dry_run ? 'Would move' : 'Moved'} #{moved_task_ids.length}; skipped #{@skipped_tasks.length}"
|
|
40
|
+
summary += ": #{@skipped_tasks.join(', ')}" unless @skipped_tasks.empty?
|
|
41
|
+
log summary
|
|
41
42
|
moved_task_ids
|
|
42
43
|
end
|
|
43
44
|
|
|
@@ -47,8 +48,8 @@ module Afterlife
|
|
|
47
48
|
task = api.get_task(task_id)
|
|
48
49
|
current_status = task&.dig('status', 'status')&.downcase
|
|
49
50
|
if current_status.nil?
|
|
50
|
-
|
|
51
|
-
return
|
|
51
|
+
reason = task.nil? ? 'task not found' : 'no status'
|
|
52
|
+
return skip_task(task_id, current_status, target_status, reason)
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
is_cherry_pick = Array(task['custom_fields']).any? do |field|
|
|
@@ -59,7 +60,9 @@ module Afterlife
|
|
|
59
60
|
next_status = next_status_for(task_id, task, target_status)
|
|
60
61
|
return if next_status.nil?
|
|
61
62
|
|
|
62
|
-
api.update_task(task_id, { status: next_status })
|
|
63
|
+
unless dry_run || api.update_task(task_id, { status: next_status })
|
|
64
|
+
return skip_task(task_id, current_status, next_status, "update failed: #{api.last_update_error}")
|
|
65
|
+
end
|
|
63
66
|
|
|
64
67
|
{
|
|
65
68
|
id: task_id,
|
|
@@ -75,18 +78,24 @@ module Afterlife
|
|
|
75
78
|
reverted = revert_detector.reverted?(task_id)
|
|
76
79
|
next_status = NextTaskStatusDecider.call(clickup_task: task, target_status:, force:, reverted:)
|
|
77
80
|
|
|
78
|
-
if reverted && next_status
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
81
|
+
if reverted && current_status == NextTaskStatusDecider::REVERT_SOURCE_STATUS && next_status
|
|
82
|
+
action = dry_run ? 'Would move' : 'Moving'
|
|
83
|
+
log "#{action} task https://app.clickup.com/t/#{task_id} to '#{next_status}': reverted in pushed commits"
|
|
84
|
+
elsif next_status.nil?
|
|
85
|
+
reason = reverted ? 'revert policy' : 'already at/after target'
|
|
86
|
+
return skip_task(task_id, current_status, target_status, reason)
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
next_status
|
|
88
90
|
end
|
|
89
91
|
|
|
92
|
+
def skip_task(task_id, current_status, target_status, reason)
|
|
93
|
+
log "Skipping task https://app.clickup.com/t/#{task_id} " \
|
|
94
|
+
"(from '#{current_status || 'unknown'}' to '#{target_status}'): #{reason}"
|
|
95
|
+
@skipped_tasks << "#{task_id} (#{reason})"
|
|
96
|
+
nil
|
|
97
|
+
end
|
|
98
|
+
|
|
90
99
|
def log(message, verbose: false)
|
|
91
100
|
return if verbose && !@verbose
|
|
92
101
|
|
data/lib/afterlife/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: afterlife
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Genaro Madrid
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-12-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|