Skip to content

Commit

Permalink
Merge pull request #1844 from github/igfoo/lombok_no_overwrite
Browse files Browse the repository at this point in the history
Lombok: Don't set env var if it's already set
  • Loading branch information
igfoo authored Aug 18, 2023
2 parents e683046 + ddf2bd2 commit e426271
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th

## [UNRELEASED]

No user facing changes.
- Fixed a bug in CodeQL Action 2.21.3 onwards that affected beta support for [Project Lombok](https://projectlombok.org/) when analyzing Java. The environment variable `CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS` will now be respected if it was manually configured in the workflow. [#1844](https://github.com/github/codeql-action/pull/1844)

## 2.21.4 - 14 Aug 2023

Expand Down
10 changes: 7 additions & 3 deletions lib/init-action.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/init-action.js.map

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

19 changes: 10 additions & 9 deletions src/init-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,18 +347,19 @@ async function run() {
}

if (config.languages.includes(Language.java)) {
if (await features.getValue(Feature.CodeqlJavaLombokEnabled, codeql)) {
logger.info("Enabling CodeQL Java Lombok support");
core.exportVariable(
"CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS",
"true",
const envVar = "CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS";
if (process.env[envVar]) {
logger.info(
`Environment variable ${envVar} already set. Not en/disabling CodeQL Java Lombok support`,
);
} else if (
await features.getValue(Feature.CodeqlJavaLombokEnabled, codeql)
) {
logger.info("Enabling CodeQL Java Lombok support");
core.exportVariable(envVar, "true");
} else {
logger.info("Disabling CodeQL Java Lombok support");
core.exportVariable(
"CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS",
"false",
);
core.exportVariable(envVar, "false");
}
}

Expand Down

0 comments on commit e426271

Please sign in to comment.