File tree 3 files changed +30
-1
lines changed
lib/rails/generators/rails
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ * Add RuboCop cache restoration to RuboCop job in GitHub Actions workflow templates.
2
+
3
+ * Lovro Bikić*
4
+
1
5
* Skip generating mailer-related files in authentication generator if the application does
2
6
not use ActionMailer
3
7
Original file line number Diff line number Diff line change 48
48
<%- unless skip_rubocop? -%>
49
49
lint:
50
50
runs-on: ubuntu-latest
51
+ env:
52
+ RUBOCOP_CACHE_ROOT: tmp/rubocop
51
53
steps:
52
54
- name: Checkout code
53
55
uses: actions/checkout@v4
58
60
ruby-version: .ruby-version
59
61
bundler-cache: true
60
62
63
+ - name: Prepare RuboCop cache
64
+ uses: actions/cache@v4
65
+ env:
66
+ DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', 'Gemfile.lock') }}
67
+ with:
68
+ path: ${{ env.RUBOCOP_CACHE_ROOT }}
69
+ key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
70
+ restore-keys: |
71
+ rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-
72
+
61
73
- name: Lint code for consistent style
62
74
run: bin/rubocop -f github
63
75
Original file line number Diff line number Diff line change 9
9
<%- unless skip_rubocop? -%>
10
10
lint:
11
11
runs-on: ubuntu-latest
12
+ env:
13
+ RUBY_VERSION: <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
14
+ RUBOCOP_CACHE_ROOT: tmp/rubocop
12
15
steps:
13
16
- name: Checkout code
14
17
uses: actions/checkout@v4
15
18
16
19
- name: Set up Ruby
17
20
uses: ruby/setup-ruby@v1
18
21
with:
19
- ruby-version: <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
22
+ ruby-version: ${{ env.RUBY_VERSION }}
20
23
bundler-cache: true
21
24
25
+ - name: Prepare RuboCop cache
26
+ uses: actions/cache@v4
27
+ env:
28
+ DEPENDENCIES_HASH: ${{ hashFiles('**/.rubocop.yml', 'Gemfile.lock') }}
29
+ with:
30
+ path: ${{ env.RUBOCOP_CACHE_ROOT }}
31
+ key: rubocop-${{ runner.os }}-${{ env.RUBY_VERSION }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
32
+ restore-keys: |
33
+ rubocop-${{ runner.os }}-${{ env.RUBY_VERSION }}-${{ env.DEPENDENCIES_HASH }}-
34
+
22
35
- name: Lint code for consistent style
23
36
run: bin/rubocop -f github
24
37
You can’t perform that action at this time.
0 commit comments