Skip to content

Commit

Permalink
Merge branch 'main' into henrymercer/controlled-switchover
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Jan 18, 2023
2 parents a5b44c1 + e0fd640 commit 5f1362d
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 31 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

Where possible, we recommend downloading and managing the CodeQL CLI via the [CodeQL extension for the GitHub CLI](https://github.com/github/gh-codeql) or [GitHub Releases](https://github.com/github/codeql-cli-binaries/releases) rather than using the CodeQL tools from the runner image tool cache.
- Python automatic dependency installation will no longer fail for projects using Poetry that specify `virtualenvs.options.no-pip = true` in their `poetry.toml`. [#1431](https://github.com/github/codeql-action/pull/1431).
- Avoid printing a stack trace and error message when the action fails to find the SHA at the
current directory. This will happen in several non-error states and so we now avoid cluttering the
log with this message. [#1485](https://github.com/github/codeql-action/pull/1485)

## 2.1.38 - 12 Jan 2023

Expand Down
5 changes: 3 additions & 2 deletions lib/actions-util.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/actions-util.js.map

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions lib/analyze.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/api-compatibility.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "maximumVersion": "3.8", "minimumVersion": "3.3" }
{ "maximumVersion": "3.8", "minimumVersion": "3.4" }
10 changes: 7 additions & 3 deletions lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/actions-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ export const getCommitOid = async function (
return commitOid.trim();
} catch (e) {
core.info(
`Failed to call git to get current commit. Continuing with data from environment or input: ${e}`
"Could not determine current commit SHA using git. Continuing with data from user input or environment."
);
core.info((e as Error).stack || "NO STACK");
core.debug(`Reason: ${(e as Error).message}`);
core.debug((e as Error).stack || "NO STACK");
return getOptionalInput("sha") || getRequiredEnvParam("GITHUB_SHA");
}
};
Expand Down
25 changes: 15 additions & 10 deletions src/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,6 @@ export async function runQueries(
);
const packsWithVersion = config.packs[language] || [];

const hasBuiltinQueries = queries?.builtin.length > 0;
const hasCustomQueries = queries?.custom.length > 0;
const hasPackWithCustomQueries = packsWithVersion.length > 0;

if (!hasBuiltinQueries && !hasCustomQueries && !hasPackWithCustomQueries) {
throw new Error(
`Unable to analyze ${language} as no queries were selected for this language`
);
}

try {
if (await util.useCodeScanningConfigInCli(codeql, featureEnablement)) {
// If we are using the code scanning config in the CLI,
Expand Down Expand Up @@ -262,6 +252,21 @@ export async function runQueries(
logger.info(analysisSummary);
} else {
// config was generated by the action, so must be interpreted by the action.

const hasBuiltinQueries = queries?.builtin.length > 0;
const hasCustomQueries = queries?.custom.length > 0;
const hasPackWithCustomQueries = packsWithVersion.length > 0;

if (
!hasBuiltinQueries &&
!hasCustomQueries &&
!hasPackWithCustomQueries
) {
throw new Error(
`Unable to analyze ${language} as no queries were selected for this language`
);
}

logger.startGroup(`Running queries for ${language}`);
const querySuitePaths: string[] = [];
if (queries["builtin"].length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/api-compatibility.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"maximumVersion": "3.8", "minimumVersion": "3.3"}
{"maximumVersion": "3.8", "minimumVersion": "3.4"}
13 changes: 10 additions & 3 deletions src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ export async function getCodeQLForCmd(
config: Config,
sourceRoot: string,
processName: string | undefined,
featureEnablement: FeatureEnablement
featureEnablement: FeatureEnablement,
logger: Logger
) {
const extraArgs = config.languages.map(
(language) => `--language=${language}`
Expand Down Expand Up @@ -577,7 +578,8 @@ export async function getCodeQLForCmd(
const configLocation = await generateCodeScanningConfig(
codeql,
config,
featureEnablement
featureEnablement,
logger
);
// Only pass external repository token if a config file is going to be parsed by the CLI.
let externalRepositoryToken: string | undefined;
Expand Down Expand Up @@ -1075,7 +1077,8 @@ async function runTool(
async function generateCodeScanningConfig(
codeql: CodeQL,
config: Config,
featureEnablement: FeatureEnablement
featureEnablement: FeatureEnablement,
logger: Logger
): Promise<string | undefined> {
if (!(await util.useCodeScanningConfigInCli(codeql, featureEnablement))) {
return;
Expand Down Expand Up @@ -1137,6 +1140,10 @@ async function generateCodeScanningConfig(
augmentedConfig.packs["javascript"].push(packString);
}
}
logger.info(`Writing augmented user configuration file to ${configLocation}`);
logger.startGroup("Augmented user configuration file contents");
logger.info(yaml.dump(augmentedConfig));
logger.endGroup();

fs.writeFileSync(configLocation, yaml.dump(augmentedConfig));
return configLocation;
Expand Down

0 comments on commit 5f1362d

Please sign in to comment.