Use new endpoint for running remote queries

This commit is contained in:
shati-patel 2021-07-02 14:57:46 +01:00 коммит произвёл Shati Patel
Родитель 977b061048
Коммит de5704974d
1 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -13,7 +13,6 @@ interface Config {
// Test "controller" repository and workflow.
const OWNER = 'dsp-testing';
const REPO = 'qc-controller';
const WORKFLOW_ID = 'codeql-query.yml';
export default async function runRemoteQuery(credentials: Credentials, uri?: Uri) {
if (!uri?.fsPath.endsWith('.ql')) {
@ -36,21 +35,23 @@ export default async function runRemoteQuery(credentials: Credentials, uri?: Uri
const ref = config.ref || 'main';
const language = config.language;
const repositories = JSON.stringify(config.repositories);
const repositories = config.repositories;
try {
await octokit.rest.actions.createWorkflowDispatch({
await octokit.request(
'POST /repos/:owner/:repo/code-scanning/codeql/queries',
{
owner: OWNER,
repo: REPO,
workflow_id: WORKFLOW_ID,
data: {
ref: ref,
inputs: {
language,
repositories,
query,
token
language: language,
repositories: repositories,
query: query,
token: token,
}
});
}
);
void showAndLogInformationMessage(`Successfully scheduled runs. [Click here to see the progress](https://github.com/${OWNER}/${REPO}/actions).`);
} catch (error) {