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