Skip to content

Commit

Permalink
Merge pull request #10 from umccr/feat/git-force
Browse files Browse the repository at this point in the history
fix: git force
  • Loading branch information
mmalenic authored Feb 18, 2025
2 parents f9a095d + eb4c1ff commit 4e63aa5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions lib/htsget-lambda.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { readFileSync } from "fs";
import { join } from "node:path";
import { tmpdir } from "os";

import {
Aws,
Expand Down Expand Up @@ -53,6 +55,7 @@ import {
JwtConfig,
} from "./config";
import { getManifestPath } from "cargo-lambda-cdk/lib/cargo";
import { exec } from "cargo-lambda-cdk/lib/util";

/**
* @ignore
Expand All @@ -68,10 +71,23 @@ export class HtsgetLambda extends Construct {
};
}

const gitRemote = "https://github.com/umccr/htsget-rs";
const gitReference = props.gitReference;
const latestCommit = exec("git", [
"ls-remote",
gitRemote,
gitReference || "HEAD",
])
.stdout.toString()
.split(/(\s+)/)[0];

const localPath = join(tmpdir(), latestCommit);

const manifestPath = getManifestPath({
gitRemote: "https://github.com/umccr/htsget-rs",
manifestPath: join(localPath, "Cargo.toml"),
gitRemote,
gitForceClone: props.gitForceClone,
gitReference: props.gitReference,
gitReference,
});
const repoDir = path.dirname(manifestPath);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
"watch": "tsc -w",
"typedoc": "typedoc"
},
"version": "0.8.1"
"version": "0.8.2"
}

0 comments on commit 4e63aa5

Please sign in to comment.