Add a debug log for the feature flag API response
This commit is contained in:
parent
2f7b9a1280
commit
e8c12e1f7d
3 changed files with 14 additions and 4 deletions
6
lib/feature-flags.js
generated
6
lib/feature-flags.js
generated
|
|
@ -244,7 +244,10 @@ class GitHubFeatureFlags {
|
||||||
owner: this.repositoryNwo.owner,
|
owner: this.repositoryNwo.owner,
|
||||||
repo: this.repositoryNwo.repo,
|
repo: this.repositoryNwo.repo,
|
||||||
});
|
});
|
||||||
return response.data;
|
const remoteFlags = response.data;
|
||||||
|
this.logger.debug("Loaded the following default values for the feature flags from the Code Scanning API: " +
|
||||||
|
`${JSON.stringify(remoteFlags)}`);
|
||||||
|
return remoteFlags;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (util.isHTTPError(e) && e.status === 403) {
|
if (util.isHTTPError(e) && e.status === 403) {
|
||||||
|
|
@ -252,6 +255,7 @@ class GitHubFeatureFlags {
|
||||||
"As a result, it will not be opted into any experimental features. " +
|
"As a result, it will not be opted into any experimental features. " +
|
||||||
"This could be because the Action is running on a pull request from a fork. If not, " +
|
"This could be because the Action is running on a pull request from a fork. If not, " +
|
||||||
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`);
|
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`);
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Some features, such as `ml_powered_queries_enabled` affect the produced alerts.
|
// Some features, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -326,7 +326,7 @@ class GitHubFeatureFlags implements FeatureEnablement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadApiResponse() {
|
private async loadApiResponse(): Promise<GitHubFeatureFlagsApiResponse> {
|
||||||
// Do nothing when not running against github.com
|
// Do nothing when not running against github.com
|
||||||
if (this.gitHubVersion.type !== util.GitHubVariant.DOTCOM) {
|
if (this.gitHubVersion.type !== util.GitHubVariant.DOTCOM) {
|
||||||
this.logger.debug(
|
this.logger.debug(
|
||||||
|
|
@ -342,7 +342,12 @@ class GitHubFeatureFlags implements FeatureEnablement {
|
||||||
repo: this.repositoryNwo.repo,
|
repo: this.repositoryNwo.repo,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return response.data;
|
const remoteFlags = response.data;
|
||||||
|
this.logger.debug(
|
||||||
|
"Loaded the following default values for the feature flags from the Code Scanning API: " +
|
||||||
|
`${JSON.stringify(remoteFlags)}`
|
||||||
|
);
|
||||||
|
return remoteFlags;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (util.isHTTPError(e) && e.status === 403) {
|
if (util.isHTTPError(e) && e.status === 403) {
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
|
|
@ -351,6 +356,7 @@ class GitHubFeatureFlags implements FeatureEnablement {
|
||||||
"This could be because the Action is running on a pull request from a fork. If not, " +
|
"This could be because the Action is running on a pull request from a fork. If not, " +
|
||||||
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`
|
`please ensure the Action has the 'security-events: write' permission. Details: ${e}`
|
||||||
);
|
);
|
||||||
|
return {};
|
||||||
} else {
|
} else {
|
||||||
// Some features, such as `ml_powered_queries_enabled` affect the produced alerts.
|
// Some features, such as `ml_powered_queries_enabled` affect the produced alerts.
|
||||||
// Considering these features disabled in the event of a transient error could
|
// Considering these features disabled in the event of a transient error could
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue