diff --git a/deployment/server.sh b/deployment/server.sh index 218e2ec..0633497 100755 --- a/deployment/server.sh +++ b/deployment/server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # # SPDX-License-Identifier: BSD-2-Clause @@ -12,8 +12,10 @@ # frozen_string_literal: true # +source /home/githubchecks/.rvm/scripts/rvm + echo ">> Running migration" -rake db:migrate +RAILS_ENV=production RACK_ENV=production bundle exec rake db:migrate echo ">> Running server" -RAILS_ENV=production RACK_ENV=production rackup -o 0.0.0.0 -p 4667 config.ru +RAILS_ENV=production RACK_ENV=production bundle exec rackup -o 0.0.0.0 -p 4667 config.ru diff --git a/lib/github/build/action.rb b/lib/github/build/action.rb index 28e8e80..51cc098 100644 --- a/lib/github/build/action.rb +++ b/lib/github/build/action.rb @@ -28,7 +28,6 @@ class Action # @param [CheckSuite] check_suite The CheckSuite to handle. # @param [Github::Check] github The Github::Check instance to use. # @param [Array] jobs The jobs to create for the CheckSuite. - # @param [String] Stage Plan name. # @param [Integer] logger_level The logging level to use (default: Logger::INFO). def initialize(check_suite, github, jobs, name, logger_level: Logger::INFO) @check_suite = check_suite @@ -120,7 +119,7 @@ def create_ci_job(job) return if stage_config.nil? - stage = Stage.find_by(check_suite: @check_suite, name: "#{stage_config.github_check_run_name} - #{@name}") + stage = Stage.find_by(check_suite: @check_suite, name: stage_name(stage_config)) logger(Logger::INFO, "create_jobs - #{job.inspect} -> #{stage.inspect}") @@ -133,7 +132,7 @@ def create_ci_job(job) # @param [StageConfiguration] stage_config The stage configuration. def create_check_run_stage(stage_config) logger(Logger::INFO, "create_check_run_stage - #{stage_config.github_check_run_name} - #{@name}") - stage = Stage.find_by(name: "#{stage_config.github_check_run_name} - #{@name}", check_suite_id: @check_suite.id) + stage = Stage.find_by(name: stage_name(stage_config), check_suite_id: @check_suite.id) return create_stage(stage_config) if stage.nil? return unless stage.configuration.can_retry? @@ -149,7 +148,7 @@ def create_check_run_stage(stage_config) # @param [StageConfiguration] stage_config The stage configuration. # @return [Stage] The created stage. def create_stage(stage_config) - name = "#{stage_config.github_check_run_name} - #{@name}" + name = stage_name(stage_config) stage = Stage.create(check_suite: @check_suite, @@ -181,6 +180,12 @@ def initial_output(ci_job) output end + def stage_name(stage_config) + return stage_config.github_check_run_name if @check_suite.pull_request.plans.count == 1 + + "#{stage_config.github_check_run_name} - #{@name}" + end + ## # Logs a message with the given severity. # diff --git a/spec/lib/github/build/action_spec.rb b/spec/lib/github/build/action_spec.rb index 02dfc54..f3c3efd 100644 --- a/spec/lib/github/build/action_spec.rb +++ b/spec/lib/github/build/action_spec.rb @@ -13,7 +13,7 @@ let(:fake_client) { Octokit::Client.new } let(:fake_github_check) { Github::Check.new(nil) } let(:check_suite) { create(:check_suite) } - let(:stage) { create(:stage, name: 'Build - Tato', check_suite: check_suite) } + let(:stage) { create(:stage, name: 'Build', check_suite: check_suite) } let(:jobs) do [ {