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

slack CLI flag can be the slack url #103

Merged
merged 1 commit into from
Dec 18, 2018
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
5 changes: 3 additions & 2 deletions docs/pages/auto-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ Options
--no-version-prefix Use the version as the tag without the 'v' prefix
--jira string Jira base URL
--use-version Version number to publish as. Defaults to reading from the package.json.
-s, --slack Post a message to slack about the release. Make sure the SLACK_TOKEN
environment variable is set.
-s, --slack string Url to post a slack message to about the release. If slack url supplied via
autorc this flag can act as a boolean. Make sure the SLACK_TOKEN environment
variable is set.

Global Options

Expand Down
7 changes: 3 additions & 4 deletions src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ const commands: ICommand[] = [
{
name: 'slack',
alias: 's',
type: Boolean,
type: String,
group: 'main',
description:
'Post a message to slack about the release. Make sure the SLACK_TOKEN environment variable is set.'
'Url to post a slack message to about the release. If slack url supplied via autorc this flag can act as a boolean. Make sure the SLACK_TOKEN environment variable is set.'
},
...defaultOptions
],
Expand Down Expand Up @@ -528,7 +528,6 @@ export interface ISemverArgs {
skipReleaseLabels?: string[];
onlyPublishWithReleaseLabel?: boolean;
jira?: string;
slack?: string;
githubApi?: string;
}

Expand All @@ -555,7 +554,7 @@ export interface IPRArgs {

export interface IReleaseArgs {
dry_run?: boolean;
slack?: string;
slack?: string | boolean;
no_version_prefix?: boolean;
use_version?: string;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export async function run(args: ArgsType) {
const explorer = cosmiconfig('auto');
const result = await explorer.search();

let rawConfig = {};
let rawConfig: cosmiconfig.Config = {};

const prefixRelease = (release: string) =>
args.no_version_prefix || release.startsWith('v') ? release : `v${release}`;
Expand All @@ -215,7 +215,8 @@ export async function run(args: ArgsType) {
const config: IGithubReleaseOptions = {
...rawConfig,
...args,
logger
logger,
slack: typeof args.slack === 'string' ? args.slack : rawConfig.slack
};

await setGitUser(config);
Expand Down