sendBuildStepNotification method

Future<void> sendBuildStepNotification({
  1. required String step,
  2. required String client,
  3. required String platform,
  4. required String status,
  5. String? additionalInfo,
  6. String? errorMessage,
})

Send build step notification

Implementation

Future<void> sendBuildStepNotification({
  required String step,
  required String client,
  required String platform,
  required String status, // started, completed, failed
  String? additionalInfo,
  String? errorMessage,
}) async {
  String emoji;
  String color;
  String message;

  switch (status.toLowerCase()) {
    case 'started':
      emoji = ':rocket:';
      color = '#36a64f'; // green
      message = 'Build step started';
      break;
    case 'completed':
      emoji = ':white_check_mark:';
      color = 'good';
      message = 'Build step completed successfully';
      break;
    case 'failed':
      emoji = ':x:';
      color = 'danger';
      message = 'Build step failed';
      break;
    default:
      emoji = ':information_source:';
      color = 'warning';
      message = 'Build step update';
  }

  final fields = <String, String>{
    'Client': client,
    'Platform': platform,
    'Step': step,
    'Status': status.toUpperCase(),
  };

  if (additionalInfo != null) {
    fields['Info'] = additionalInfo;
  }

  if (errorMessage != null) {
    fields['Error'] = errorMessage;
  }

  final success = await sendRichMessage(
    title: '$emoji Build Update - $step',
    message: message,
    color: color,
    fields: fields,
  );

  if (!success) {
    print('⚠️ Failed to send build step notification for: $step');
  }
}