Skip to content

Commit

Permalink
setup-ocaml/cache: generate key for local repositories
Browse files Browse the repository at this point in the history
The location might be a relative filepath instead of a url, create a
fallback path for these, sidestepping opam to create the url for all
cases.
  • Loading branch information
psafont committed Mar 20, 2023
1 parent 8979b62 commit 0acdb79
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [unreleased]

### Fixed

- Ensure cache key creation works with local opam repositories.

## [2.0.12]

### Changed
Expand Down
11 changes: 8 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/setup-ocaml/cache.ts
Expand Up @@ -95,9 +95,13 @@ async function composeOpamCacheKeys() {

function composeOpamDownloadCacheKeys() {
const repositories = OPAM_REPOSITORIES.map(([, u]) => {
const url = new URL(u);
const urn = path.join(url.hostname, url.pathname);
return urn;
try {
const url = new URL(u);
const urn = path.join(url.hostname, url.pathname);
return urn;
} catch {
return path.resolve(u);
}
}).join("_");
const ocamlVersion = OCAML_COMPILER.toLowerCase().replace(/\W/g, "_");
const { year, month, date } = composeDate();
Expand Down

0 comments on commit 0acdb79

Please sign in to comment.