#!/usr/bin/env ruby require 'json' require 'ostruct' environment_tag = ARGV[0]&.strip if environment_tag.nil? || environment_tag.empty? puts "Usage: stories-deployed ENVIRONMENT" exit 1 end deployed_story_infos = `story-ids-deployed #{environment_tag} | get-story-info-from-id` stories_deployed = deployed_story_infos.split("\n").compact.reduce([]) do |reduced, story_info| story = OpenStruct.new(JSON.parse(story_info)) reduced << "#{story.error}" reduced << "#{story.name}:\n#{story.url}" end puts stories_deployed