diff --git a/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt b/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt index da661c710b715..0af0b0d6fd2ad 100644 --- a/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt @@ -131,6 +131,7 @@ jobs: <%- else -%> run: bin/rails db:test:prepare test test:system <%- end -%> + <%- unless options[:api] -%> - name: Keep screenshots from failed system tests uses: actions/upload-artifact@v4 @@ -139,4 +140,5 @@ jobs: name: screenshots path: ${{ github.workspace }}/tmp/screenshots if-no-files-found: ignore + <%- end -%> <% end -%> diff --git a/railties/test/generators/api_app_generator_test.rb b/railties/test/generators/api_app_generator_test.rb index 0a0c3a100bba3..da29d99ba706b 100644 --- a/railties/test/generators/api_app_generator_test.rb +++ b/railties/test/generators/api_app_generator_test.rb @@ -57,6 +57,11 @@ def test_api_modified_files assert_file "config/environments/production.rb" do |content| assert_no_match(/action_controller\.perform_caching = true/, content) end + + assert_file ".github/workflows/ci.yml" do |content| + assert_no_match(/test:system/, content) + assert_no_match(/screenshots/, content) + end end def test_dockerfile