Skip to content

Commit

Permalink
uppercase REPO_TOKEN
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Apr 29, 2021
1 parent e98c91b commit e6c8fec
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/cml-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const argv = yargs
.default('token')
.describe(
'token',
'Personal access token to be used. If not specified in extracted from ENV repo_token or GITLAB_TOKEN.'
'Personal access token to be used. If not specified in extracted from ENV REPO_TOKEN or GITLAB_TOKEN.'
)
.default('driver')
.choices('driver', ['github', 'gitlab'])
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('CML e2e', () => {
--repo Specifies the repo to be used. If not specified is extracted
from the CI ENV.
--token Personal access token to be used. If not specified in
extracted from ENV repo_token or GITLAB_TOKEN.
extracted from ENV REPO_TOKEN or GITLAB_TOKEN.
--driver If not specify it infers it from the ENV.
[choices: \\"github\\", \\"gitlab\\"]
-h Show help [boolean]"
Expand Down
4 changes: 2 additions & 2 deletions bin/cml-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
RUNNER_REUSE = false,
RUNNER_DRIVER,
RUNNER_REPO,
repo_token
REPO_TOKEN
} = process.env;

let cml;
Expand Down Expand Up @@ -350,7 +350,7 @@ const opts = decamelize(
'repo',
'Repository to be used for registering the runner. If not specified, it will be inferred from the environment'
)
.default('token', repo_token)
.default('token', REPO_TOKEN)
.describe(
'token',
'Personal access token to register a self-hosted runner on the repository. If not specified, it will be inferred from the environment'
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-send-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const argv = yargs
.default('token')
.describe(
'token',
'Personal access token to be used. If not specified in extracted from ENV repo_token.'
'Personal access token to be used. If not specified in extracted from ENV REPO_TOKEN.'
)
.default('driver')
.choices('driver', ['github', 'gitlab'])
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-send-comment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Comment integration tests', () => {
--repo Specifies the repo to be used. If not specified is extracted
from the CI ENV.
--token Personal access token to be used. If not specified in
extracted from ENV repo_token.
extracted from ENV REPO_TOKEN.
--driver If not specify it infers it from the ENV.
[choices: \\"github\\", \\"gitlab\\"]
-h Show help [boolean]"
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-send-github-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const argv = yargs
.default('token')
.describe(
'token',
'Personal access token to be used. If not specified in extracted from ENV repo_token.'
'Personal access token to be used. If not specified in extracted from ENV REPO_TOKEN.'
)
.help('h')
.demand(1).argv;
Expand Down
2 changes: 1 addition & 1 deletion bin/cml-send-github-check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('CML e2e', () => {
--repo Specifies the repo to be used. If not specified is extracted
from the CI ENV.
--token Personal access token to be used. If not specified in extracted
from ENV repo_token.
from ENV REPO_TOKEN.
-h Show help [boolean]
--conclusion[choices: \\"success\\", \\"failure\\", \\"neutral\\", \\"cancelled\\", \\"skipped\\",
\\"timed_out\\"] [default: Sets the conclusion status of the check.]"
Expand Down
7 changes: 5 additions & 2 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ const get_driver = (opts) => {

const infer_token = () => {
const {
REPO_TOKEN,
repo_token,
GITHUB_TOKEN,
GITLAB_TOKEN,
BITBUCKET_TOKEN
} = process.env;
return repo_token || GITHUB_TOKEN || GITLAB_TOKEN || BITBUCKET_TOKEN;
return (
REPO_TOKEN || repo_token || GITHUB_TOKEN || GITLAB_TOKEN || BITBUCKET_TOKEN
);
};

class CML {
Expand Down Expand Up @@ -231,7 +234,7 @@ class CML {
await this.runner_token();
} catch (err) {
throw new Error(
'repo_token does not have enough permissions to access workflow API'
'REPO_TOKEN does not have enough permissions to access workflow API'
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('Github tests', () => {
jest.resetModules();

process.env = {};
process.env.repo_token = TOKEN;
process.env.REPO_TOKEN = TOKEN;
});

afterAll(() => {
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('Gitlab tests', () => {
jest.resetModules();

process.env = {};
process.env.repo_token = TOKEN;
process.env.REPO_TOKEN = TOKEN;
});

afterAll(() => {
Expand Down

0 comments on commit e6c8fec

Please sign in to comment.