@@ -59,6 +59,9 @@ class Utils {
59
59
let jfrogCredentials = this . collectJfrogCredentialsFromEnvVars ( ) ;
60
60
const oidcProviderName = core . getInput ( Utils . OIDC_INTEGRATION_PROVIDER_NAME ) ;
61
61
if ( ! oidcProviderName ) {
62
+ // Set environment variable to track OIDC usage.
63
+ core . exportVariable ( 'JFROG_CLI_USAGE_CONFIG_OIDC' , '' ) ;
64
+ core . exportVariable ( 'JFROG_CLI_USAGE_OIDC_USED' , 'FALSE' ) ;
62
65
// Use JF_ENV or the credentials found in the environment variables
63
66
return jfrogCredentials ;
64
67
}
@@ -78,8 +81,9 @@ class Utils {
78
81
const applicationKey = yield this . getApplicationKey ( ) ;
79
82
try {
80
83
jfrogCredentials = yield this . getJfrogAccessTokenThroughOidcProtocol ( jfrogCredentials , jsonWebToken , oidcProviderName , applicationKey ) ;
81
- // Set environment variable to track OIDC logins in the usage report .
84
+ // Set environment variable to track OIDC usage.
82
85
core . exportVariable ( 'JFROG_CLI_USAGE_CONFIG_OIDC' , 'TRUE' ) ;
86
+ core . exportVariable ( 'JFROG_CLI_USAGE_OIDC_USED' , 'TRUE' ) ;
83
87
return jfrogCredentials ;
84
88
}
85
89
catch ( error ) {
@@ -98,7 +102,7 @@ class Utils {
98
102
*/
99
103
static getApplicationKey ( ) {
100
104
return __awaiter ( this , void 0 , void 0 , function * ( ) {
101
- const configFilePath = path . join ( this . JF_CONFIG_DIR_NAME , this . JF_CONFIG_FILE ) ;
105
+ const configFilePath = path . join ( this . JF_CONFIG_DIR_NAME , this . JF_CONFIG_FILE_NAME ) ;
102
106
try {
103
107
const config = yield this . readConfigFromFileSystem ( configFilePath ) ;
104
108
if ( ! config ) {
@@ -445,6 +449,23 @@ class Utils {
445
449
if ( ! core . getBooleanInput ( Utils . JOB_SUMMARY_DISABLE ) ) {
446
450
Utils . enableJobSummaries ( ) ;
447
451
}
452
+ Utils . setUsageEnvVars ( ) ;
453
+ }
454
+ // Set usage variables to be captured by JFrog CLI.
455
+ static setUsageEnvVars ( ) {
456
+ // Repository name, defaulting to an empty string if undefined.
457
+ const repoName = process . env . GITHUB_REPOSITORY || '' ;
458
+ // Workflow name, defaulting to an empty string if undefined.
459
+ const jobId = process . env . GITHUB_WORKFLOW || '' ;
460
+ // Run ID, defaulting to an empty string if undefined.
461
+ const runId = process . env . GITHUB_RUN_ID || '' ;
462
+ // Boolean flag indicating if JF_GIT_TOKEN is set.
463
+ const jfGitTokenSet = ! ! process . env . JF_GIT_TOKEN ;
464
+ // Export environment variables for JFrog CLI usage.
465
+ core . exportVariable ( 'JFROG_CLI_USAGE_JOB_ID' , jobId ) ;
466
+ core . exportVariable ( 'JFROG_CLI_USAGE_RUN_ID' , runId ) ;
467
+ core . exportVariable ( 'JFROG_CLI_USAGE_GIT_REPO' , repoName ) ;
468
+ core . exportVariable ( 'JFROG_CLI_USAGE_GH_TOKEN_FOR_CODE_SCANNING_ALERTS_PROVIDED' , jfGitTokenSet ) ;
448
469
}
449
470
/**
450
471
* Enabling job summary is done by setting the output dir for the summaries.
@@ -885,7 +906,7 @@ Utils.KEY = 'key';
885
906
// Config file directory name
886
907
Utils . JF_CONFIG_DIR_NAME = '.jfrog' ;
887
908
// Config file name
888
- Utils . JF_CONFIG_FILE = 'config.yml' ;
909
+ Utils . JF_CONFIG_FILE_NAME = 'config.yml' ;
889
910
// Disable Job Summaries feature flag
890
911
Utils . JOB_SUMMARY_DISABLE = 'disable-job-summary' ;
891
912
// Disable auto build info publish feature flag
0 commit comments