diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b1575d..e769bea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,4 +56,9 @@ jobs: name: Exceptions - name: Run print_log task run: bundle exec rake failing_specs_detector:print_log + - name: Get results + id: results + run: echo "log=$(cat failing_spec_detector.txt )" >> $GITHUB_OUTPUT + - name: Print result + run: echo ${{ steps.results.outputs.log }} diff --git a/lib/failing_spec_detector/combiner.rb b/lib/failing_spec_detector/combiner.rb index 0a1d575..fd5d5cd 100644 --- a/lib/failing_spec_detector/combiner.rb +++ b/lib/failing_spec_detector/combiner.rb @@ -6,19 +6,20 @@ class Combiner def initialize(exceptions, failures) @exceptions = exceptions @failures = failures + @filename = 'failing_specs_detector.txt' end def combine - puts "Failing specs detector:\n\n\n" + File.write(@filename, "Failing specs detector:\n\n\n") @exceptions.uniq.each do |exception| - puts "#{exception}:\n\n" + File.write(@filename, "#{exception}:\n\n", mode: 'a') related_examples = @failures.select { |failure| failure.exception == exception } next if related_examples.empty? related_examples.each do |failure| - puts "#{failure.backtrace}:\n" + File.write(@filename, "#{failure.backtrace}:\n", mode: 'a') end - puts "\n\n\n" + File.write(@filename, "\n\n\n", mode: 'a') end end end