Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uppercase REPO_TOKEN #489

Merged
merged 3 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, extracted from ENV REPO_TOKEN, GITLAB_TOKEN, GITHUB_TOKEN, or BITBUCKET_TOKEN.'
)
.default('driver')
.choices('driver', ['github', 'gitlab'])
Expand Down
5 changes: 3 additions & 2 deletions bin/cml-publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ describe('CML e2e', () => {
exist.
--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.
--token Personal access token to be used. If not specified,
extracted from ENV REPO_TOKEN, GITLAB_TOKEN, GITHUB_TOKEN,
or BITBUCKET_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