Skip to content

Commit 1727de3

Browse files
committed
Add commit sha to database upload
1 parent 3dd4ad8 commit 1727de3

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

lib/database-upload.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/database-upload.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/database-upload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as fs from "fs";
22

33
import * as actionsUtil from "./actions-util";
4+
import { getOptionalInput } from "./actions-util";
45
import { getApiClient, GitHubApiDetails } from "./api-client";
56
import { getCodeQL } from "./codeql";
67
import { Config } from "./config-utils";
@@ -44,6 +45,8 @@ export async function uploadDatabases(
4445
const bundledDb = await bundleDb(config, language, codeql, language);
4546
const bundledDbSize = fs.statSync(bundledDb).size;
4647
const bundledDbReadStream = fs.createReadStream(bundledDb);
48+
const commitOid =
49+
getOptionalInput("sha") || process.env["GITHUB_SHA"] || "";
4750
try {
4851
await client.request(
4952
`POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`,
@@ -52,6 +55,7 @@ export async function uploadDatabases(
5255
repo: repositoryNwo.repo,
5356
language,
5457
name: `${language}-database`,
58+
commit_oid: commitOid,
5559
data: bundledDbReadStream,
5660
headers: {
5761
authorization: `token ${apiDetails.auth}`,

0 commit comments

Comments
 (0)