File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
framework/codemodder-testutils-llm/src/main/java/io/codemodder/testutils/llm Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6868
6969 - name : Run Check task
7070 uses : gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
71+ env :
72+ CODEMODDER_OPENAI_API_KEY : ${{ secrets.CODEMODDER_OPENAI_API_KEY }}
7173 with :
7274 arguments : check --stacktrace
7375 cache-read-only : ${{ github.ref != 'refs/heads/main' }}
Original file line number Diff line number Diff line change 3636 java-version : ' 17'
3737
3838 - uses : gradle/gradle-build-action@v2
39+ env :
40+ CODEMODDER_OPENAI_API_KEY : ${{ secrets.CODEMODDER_OPENAI_API_KEY }}
3941 with :
4042 cache-read-only : ${{ github.ref != 'refs/heads/main' }}
4143 arguments : --console=plain --quiet --no-configuration-cache -Pversion=${{ inputs.version }} build distZip publishNebulaPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
Original file line number Diff line number Diff line change @@ -12,9 +12,17 @@ private CodemodderOpenAIKeys() {}
1212 /**
1313 * Return true if and only if we have a non-empty {@code CODEMODDER_OPENAI_API_KEY} environment
1414 * variable.
15+ *
16+ * @throws IllegalStateException when running in a CI/CD environment and the key is not available.
17+ * This is backstop to ensure that all expected tests run in CI/CD.
1518 */
1619 public static boolean isAvailable () {
1720 String key = System .getenv ("CODEMODDER_OPENAI_API_KEY" );
18- return key != null && !key .isBlank ();
21+ final var available = key != null && !key .isBlank ();
22+ if (System .getenv ("CI" ) != null && !available ) {
23+ throw new IllegalStateException (
24+ "The CODEMODDER_OPENAI_API_KEY environment variable must be set in the CI/CD environment." );
25+ }
26+ return available ;
1927 }
2028}
You can’t perform that action at this time.
0 commit comments