Skip to content

Commit

Permalink
feat(sentry/notify): read env.BRANCH_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed Dec 26, 2023
1 parent e38f945 commit 6fdbc66
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 27 deletions.
6 changes: 3 additions & 3 deletions packages/notify/lib/action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const logger = new Logger(task);
const { DingTalkRobotToken } = process.env;

// eslint-disable-next-line consistent-return
export async function action({ mode }) {
export async function action({ name }) {
try {
const { [mode]: config, ...rest } = await readConfig(task, logger);
const { [name]: config, ...rest } = await readConfig(task, logger);

const all = { ...rest, ...config };

logger.json({ mode, ...all });
logger.json({ name, ...all });

if (!(DingTalkRobotToken || all.subscribe?.length)) {
logger.fail('env.DingTalkRobotToken or config.subscribe is required');
Expand Down
6 changes: 3 additions & 3 deletions packages/notify/lib/cmd.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export const command = 'notify';
export const describe = 'Send releases notifications';

export function builder(cli) {
cli.option('mode', {
alias: 'm',
describe: 'notify mode',
cli.option('name', {
alias: 'n',
describe: 'notify name',
default: 'noop',
type: 'string',
});
Expand Down
2 changes: 1 addition & 1 deletion packages/notify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/notify",
"version": "0.2.12",
"version": "0.3.0",
"description": "Send releases notifications",
"license": "MIT",
"author": {
Expand Down
19 changes: 6 additions & 13 deletions packages/sentry/lib/cmd.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@ export const command = 'sentry';
export const describe = 'Update sentry artifacts';

export function builder(cli) {
cli
.option('mode', {
alias: 'm',
describe: 'deploy mode',
default: 'noop',
type: 'string',
})
.option('name', {
alias: 'n',
describe: 'deploy name',
default: 'noop',
type: 'string',
});
cli.option('name', {
alias: 'n',
describe: 'deploy name',
default: 'noop',
type: 'string',
});
}

export function handler(io) {
Expand Down
10 changes: 4 additions & 6 deletions packages/sentry/lib/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ function createCli({ url, org, project, token }) {
};
}

export async function action({ mode, name }) {
export async function action({ name }) {
try {
const { [name || mode]: current, ...all } = await readConfig(
'sentry',
logger,
);
const { [name]: current, ...all } = await readConfig('sentry', logger);

const {
url,
Expand All @@ -66,7 +63,6 @@ export async function action({ mode, name }) {
url,
org,
project,
mode,
name,
include,
});
Expand Down Expand Up @@ -96,6 +92,8 @@ export async function action({ mode, name }) {

logger.task('uploading...');

const mode = process.env.BRANCH_NAME;

await cli(
'files',
version,
Expand Down
2 changes: 1 addition & 1 deletion packages/sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bring-it/sentry",
"version": "0.4.0",
"version": "0.5.0",
"description": "Update sentry artifacts",
"license": "MIT",
"author": {
Expand Down

0 comments on commit 6fdbc66

Please sign in to comment.