Skip to content

Commit 72aa4f0

Browse files
Merge pull request #1226 from github/robertbrignull/allow-custom-action-branch
Allow a custom branch name in settings file
2 parents 38da598 + fd57cc9 commit 72aa4f0

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

extensions/ql-vscode/src/config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,14 @@ export function getRemoteControllerRepo(): string | undefined {
357357
export async function setRemoteControllerRepo(repo: string | undefined) {
358358
await REMOTE_CONTROLLER_REPO.updateValue(repo, ConfigurationTarget.Global);
359359
}
360+
361+
/**
362+
* The branch of "github/codeql-variant-analysis-action" to use with the "Run Variant Analysis" command.
363+
* Default value is "main".
364+
* Note: This command is only available for internal users.
365+
*/
366+
const ACTION_BRANCH = new Setting('actionBranch', REMOTE_QUERIES_SETTING);
367+
368+
export function getActionBranch(): string {
369+
return ACTION_BRANCH.getValue<string>() || 'main';
370+
}

extensions/ql-vscode/src/remote-queries/run-remote-query.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { Credentials } from '../authentication';
1717
import * as cli from '../cli';
1818
import { logger } from '../logging';
19-
import { getRemoteControllerRepo, getRemoteRepositoryLists, setRemoteControllerRepo } from '../config';
19+
import { getActionBranch, getRemoteControllerRepo, getRemoteRepositoryLists, setRemoteControllerRepo } from '../config';
2020
import { ProgressCallback, UserCancellationException } from '../commandRunner';
2121
import { OctokitResponse } from '@octokit/types/dist-types';
2222
import { RemoteQuery } from './remote-query';
@@ -302,7 +302,8 @@ export async function runRemoteQuery(
302302
message: 'Sending request'
303303
});
304304

305-
const workflowRunId = await runRemoteQueriesApiRequest(credentials, 'main', language, repositories, owner, repo, base64Pack, dryRun);
305+
const actionBranch = getActionBranch();
306+
const workflowRunId = await runRemoteQueriesApiRequest(credentials, actionBranch, language, repositories, owner, repo, base64Pack, dryRun);
306307
const queryStartTime = Date.now();
307308
const queryMetadata = await tryGetQueryMetadata(cliServer, queryFile);
308309

0 commit comments

Comments
 (0)