Skip to content

Upload database with commit SHA and branch name #1399

Open
@PavelBansky

Description

@PavelBansky

Would it be possible to extend the CodeQL database upload/download API to contain the commit sha and branch name?
Having a database but not knowing which source code version it is belonging too, is not very useful.

This is code from src/database-upload.ts. Perfect place to pass the SHA and branch.

        `POST https://uploads.github.com/repos/:owner/:repo/code-scanning/codeql/databases/:language?name=:name`,
        {
          owner: repositoryNwo.owner,
          repo: repositoryNwo.repo,
          language,
          name: `${language}-database`,
          data: payload,
          headers: {
            authorization: `token ${apiDetails.auth}`,
            "Content-Type": "application/zip",
          },
        }

When calling the database list API:
https://api.github.com/repos/{repository full name}/code-scanning/codeql/databases

It would be nice to see the branch name and commit sha in the response.

[
{
    "id": 11071980,
    "name": "javascript-database",
    "language": "javascript",
    "uploader": {
            --- REMOVED TO REDUCE COMPLEXITY ---
    },
    "content_type": "application/zip",
    "size": 5680496,
    "created_at": "2022-11-28T14:19:59Z",
    "updated_at": "2022-11-28T14:19:59Z",
    "url": "https://api.github.com/repositories/553492177/code-scanning/codeql/databases/javascript"
  }
]

Metadata

Metadata

Assignees

Labels

CodeQL ActionThis repo! Helps for internal planningenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions