From de5704974d251c04636067afd2ab9a4339027577 Mon Sep 17 00:00:00 2001 From: shati-patel <42641846+shati-patel@users.noreply.github.com> Date: Fri, 2 Jul 2021 14:57:46 +0100 Subject: [PATCH] Use new endpoint for running remote queries --- extensions/ql-vscode/src/run-remote-query.ts | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/extensions/ql-vscode/src/run-remote-query.ts b/extensions/ql-vscode/src/run-remote-query.ts index 29afdbfce..d46ca3748 100644 --- a/extensions/ql-vscode/src/run-remote-query.ts +++ b/extensions/ql-vscode/src/run-remote-query.ts @@ -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({ - owner: OWNER, - repo: REPO, - workflow_id: WORKFLOW_ID, - ref: ref, - inputs: { - language, - repositories, - query, - token + await octokit.request( + 'POST /repos/:owner/:repo/code-scanning/codeql/queries', + { + owner: OWNER, + repo: REPO, + data: { + ref: ref, + 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) {