Skip to content

Commit 1fa4695

Browse files
Merge #420
420: Canonicalize some `Period`s and `CompoundPeriod`s when logging them with `@info` r=DilumAluthge a=DilumAluthge Right now, if a PR has not yet met the minimum waiting period, we print the age like this: ``` pr_age = 1234567 milliseconds ``` This is not very helpful. So let's also use `Dates.canonicalize` to print the age in a more human-readable format. Co-authored-by: Dilum Aluthge <[email protected]>
2 parents 0af2fbc + 60bbe8d commit 1fa4695

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RegistryCI"
22
uuid = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32"
33
authors = ["Dilum Aluthge <[email protected]>", "Fredrik Ekre <[email protected]>", "contributors"]
4-
version = "7.1.7"
4+
version = "7.2.0-DEV"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/AutoMerge/AutoMerge.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ include("assert.jl")
2525
include("automerge_comment.jl")
2626
include("changed_files.jl")
2727
include("cron.jl")
28+
include("dates.jl")
2829
include("dependency_confusion.jl")
2930
include("github.jl")
3031
include("guidelines.jl")

src/AutoMerge/cron.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ function cron_or_api_build(
322322
"Reason: mandatory waiting period has not elapsed.",
323323
),
324324
pr_type,
325-
pr_age,
325+
pr_age, _canonicalize_period(pr_age),
326326
pkg,
327327
is_jll_name(pkg),
328-
new_package_waiting_period,
329-
new_jll_package_waiting_period,
330-
new_version_waiting_period,
331-
new_jll_version_waiting_period,
328+
new_package_waiting_period, _canonicalize_period(new_package_waiting_period),
329+
new_jll_package_waiting_period, _canonicalize_period(new_jll_package_waiting_period),
330+
new_version_waiting_period, _canonicalize_period(new_version_waiting_period),
331+
new_jll_version_waiting_period, _canonicalize_period(new_jll_version_waiting_period),
332332
pr_author,
333333
authorized_authors,
334334
authorized_authors_special_jll_exceptions

src/AutoMerge/dates.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function _canonicalize_period(p::Dates.CompoundPeriod)
2+
return Dates.canonicalize(p)
3+
end
4+
5+
function _canonicalize_period(p::Dates.Period)
6+
return _canonicalize_period(Dates.CompoundPeriod(p))
7+
end

src/AutoMerge/public.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Run the `RegistryCI.AutoMerge` service.
66
# Arguments
77
88
- `env`: an `AbstractDictionary` used to read environmental variables from.
9-
Defaults to `ENV` but a plain `Dict` can be passed to mimic an alternate environment.
9+
Defaults to `ENV` but a plain `Dict` can be passed to mimic an alternate environment.
1010
- `ciccfg`: Configuration struct describing the continuous integration (CI) environment in which AutoMerge is being run.
1111
1212
# Keyword Arguments

0 commit comments

Comments
 (0)