Skip to content

Commit b23f27a

Browse files
committed
Try to determine registry name in CompatHelper workflow
1 parent 4e63aa7 commit b23f27a

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ on:
88
default: "1"
99
required: false
1010
type: string
11-
local-registry-names:
12-
description: 'Names of registries besides General to use. Specified by providing the name of the registries
13-
as a newline (\n) seperated list. Should correspond to the registry URLs listed in `local-registry-urls`.'
14-
default: ""
15-
required: false
16-
type: string
1711
local-registry-urls:
1812
description: 'URLs of registries besides General to use. Specified by providing the url (https/ssh) to the Github
1913
repositories as a newline (\n) seperated list. Should correspond to the registry names listed in
2014
`local-registry-names`.'
2115
default: ""
2216
required: false
2317
type: string
18+
local-registry-names:
19+
description: 'Names of registries besides General to use. Specified by providing the name of the registries
20+
as a newline (\n) seperated list. Should correspond to the registry URLs listed in `local-registry-urls`.'
21+
default: ""
22+
required: false
23+
type: string
2424

2525
jobs:
2626
CompatHelper:
@@ -60,12 +60,17 @@ jobs:
6060
url = "https://github.com/JuliaRegistries/General.git",
6161
)
6262
]
63-
if !isempty("${{ inputs.local-registry-names }}") && !isempty("${{ inputs.local-registry-urls }}")
64-
registry_names = split("${{ inputs.local-registry-names }}", "\n") .|> string
63+
if !isempty("${{ inputs.local-registry-urls }}")
6564
registry_urls = split("${{ inputs.local-registry-urls }}", "\n") .|> string
66-
for (registry_name, registry_url) in zip(registry_names, registry_urls)
67-
(isempty(registry_name) || isempty(registry_url)) && continue
68-
push!(registries, Pkg.RegistrySpec(; name=registry_name, url=registry_url))
65+
registry_names = if !isempty("${{ inputs.local-registry-names }}")
66+
split("${{ inputs.local-registry-names }}", "\n") .|> string
67+
else
68+
# Guess the registry name from the last part of the repository URL.
69+
map(registry_url -> first(split(last(split(registry_url, '/')), '.')), registry_urls)
70+
end
71+
for (registry_url, registry_name) in zip(registry_urls, registry_names)
72+
isempty(registry_url) && continue
73+
push!(registries, Pkg.RegistrySpec(; url=registry_url, name=registry_name))
6974
end
7075
end
7176
CompatHelper.main(; registries, bump_version=true)

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,13 @@ The CompatHelper workflow is designed to periodically check dependencies for bre
181181
releases, and if so make PRs to bump the compat versions. By default this workflow
182182
checks the Julia [General registry](https://github.com/JuliaRegistries/General)
183183
for breaking releases of dependencies, but you can add other registries
184-
by specifying the registry names in the `local-registry-names` option
185-
and the registry repository URLs in the `local-registy-urls` option.
186-
Both should be strings with registries seperated by a newline character (`\n`).
187-
Here is an example workflow:
184+
by specifying the registry URLs with the `local-registy-urls` option,
185+
which should be strings with registry URLs seperated by a newline character (`\n`).
186+
Registry names will be guess from the URLs, for example if a registry URL
187+
is "https://github.com/ITensor/ITensorRegistry.git" we will guess that the
188+
registry name is "ITensorRegistry". If that is not the case for one or more registry,
189+
you will need to specify all of the registry names as well using the `local-registry-names`
190+
in the same format. Here is an example workflow:
188191

189192
```yaml
190193
name: "CompatHelper"
@@ -202,6 +205,5 @@ jobs:
202205
name: "CompatHelper"
203206
uses: "ITensor/ITensorActions/.github/workflows/CompatHelper.yml@main"
204207
with:
205-
local-registry-names: "ITensorRegistry"
206208
local-registry-urls: "https://github.com/ITensor/ITensorRegistry.git"
207209
```

0 commit comments

Comments
 (0)