Skip to content

Commit

Permalink
Rewrite legacy environment variable prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
0x2b3bfa0 committed Aug 19, 2022
1 parent e60733c commit bde9359
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bin/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ const setupOpts = (opts) => {
if (process.env[oldName]) process.env[newName] = process.env[oldName];
}

const legacyEnvironmentPrefixes = {
CML_CI: 'CML_REPOSITORY',
CML_PUBLISH: 'CML_ASSET',
CML_RERUN_WORKFLOW: 'CML_WORKFLOW',
CML_SEND_COMMENT: 'CML_REPORT',
CML_SEND_GITHUB_CHECK: 'CML_CHECK',
CML_TENSORBOARD_DEV: 'CML_TENSORBOARD'
};

for (const [oldPrefix, newPrefix] of Object.entries(
legacyEnvironmentPrefixes
)) {
for (const key in process.env) {
if (key.startsWith(`${oldPrefix}_`))
process.env[key.replace(oldPrefix, newPrefix)] = process.env[key];
}
}

console.error(process.env);

const { markdownfile } = opts;
opts.markdownFile = markdownfile;
opts.cmlCommand = opts._[0];
Expand Down

2 comments on commit bde9359

@0x2b3bfa0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

CML watermark

Please sign in to comment.