Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.27.0)
rails (> 7.1)

GEM
Expand Down
2 changes: 1 addition & 1 deletion example_rails7/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.27.0)
rails (> 7.1)

GEM
Expand Down
4 changes: 2 additions & 2 deletions example_rails8/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
rolemodel_rails (0.26.0)
rolemodel_rails (0.27.0)
rails (> 7.1)

GEM
Expand Down Expand Up @@ -522,7 +522,7 @@ CHECKSUMS
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rolemodel_rails (0.26.0)
rolemodel_rails (0.27.0)
rubocop (1.84.1) sha256=14cc626f355141f5a2ef53c10a68d66b13bb30639b26370a76559096cc6bcc1a
rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
Expand Down
31 changes: 12 additions & 19 deletions lib/generators/rolemodel/github/github_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@

module Rolemodel
class GithubGenerator < BaseGenerator
# Source root is the project-level .github directory
# This allows us to use the same templates for both the generated app and this gem
source_root File.expand_path('.github')
# Files which are both used by the gem source and copied to the target app without modification
# are placed in the `.github` folder at the top level of this repository. This folder is then
# symlinked to the `templates` folder relative to this generator so they can still be copied over.
# Any files which are significantly different or not used by the gem source are just in `templates`.
source_root File.expand_path('templates', __dir__)

def install_pull_request_template
def install_github_config
directory 'instructions', '.github/instructions'
directory 'workflows', '.github/workflows'
template 'pull_request_template.md', '.github/pull_request_template.md'
end

def remove_rolemodel_rails_version_check
gsub_file '.github/pull_request_template.md',
"* [ ] Run `bin/bump_version` or `bin/bump_version --patch`\n",
''
end

def install_copilot_instructions
copy_file 'instructions/css.instructions.md', '.github/instructions/css.instructions.md'
copy_file 'instructions/js.instructions.md', '.github/instructions/js.instructions.md'
copy_file 'instructions/project.instructions.md', '.github/instructions/project.instructions.md'
copy_file 'instructions/ruby.instructions.md', '.github/instructions/ruby.instructions.md'
copy_file 'instructions/slim.instructions.md', '.github/instructions/slim.instructions.md'
end
def install_dependabot_and_codeowners
copy_file 'dependabot.yml', '.github/dependabot.yml'
copy_file 'CODEOWNERS', '.github/CODEOWNERS'

def install_ci_yml
copy_file 'templates/ci.yml', '.github/workflows/ci.yml'
say '👉 See CODEOWNERS file for important instructions.', %i[bold red on_blue]
end

def update_database_yml_for_ci
Expand Down
8 changes: 8 additions & 0 deletions lib/generators/rolemodel/github/templates/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is used by Dependabot (and more broadly GitHub) to determine who needs to review
# pull requests which contain changes to specific files. Specifically, the setup below allows
# for the dependabot PRs to automatically assign (and notify) the Craftsman and Support Dev.

# Dependabot / Dependency reviewers:
# TODO: Update and uncomment the following lines.
# yarn.lock @craftsman @supportdev
# Gemfile.lock @craftsman @supportdev
87 changes: 87 additions & 0 deletions lib/generators/rolemodel/github/templates/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
version: 2
registries:
ruby-github:
type: rubygems-server
url: https://rubygems.pkg.github.com/RoleModel
token: ${{ secrets.ROLEMODEL_PACKAGE_REPO_READ_TOKEN }}

updates:
- package-ecosystem: bundler
insecure-external-code-execution: allow
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing insecure external code execution in Dependabot configuration poses a security risk. This setting permits execution of arbitrary code during dependency updates, which could be exploited if a malicious dependency is introduced. Consider removing this line unless there's a specific, documented requirement for it, and if needed, add a comment explaining why it's necessary.

Suggested change
insecure-external-code-execution: allow

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required because of health-check and possibly this gem (rolemodel_rails).
As a counter suggestion:

Suggested change
insecure-external-code-execution: allow
# NOTE: Copilot will complain about this line, but it is needed,
# otherwise Dependabot cannot access internal RoleModel gems.
insecure-external-code-execution: allow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this for now, but I'd like you to explain this to me in detail sometime.

Maybe then we can put our heads together and see if something useful is knocked loose..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point it might be good to consider if our Health Check approach is worth just having almanac pull everything it needs for SHM.

registries:
- ruby-github
directory: /
schedule:
interval: weekly
day: monday
# Ignore specific dependencies or update types which may cause issues. For example:
# ignore:
# - dependency-name: 'some-gem'
# - update-types: ['version-update:semver-major']
groups:
production-security:
dependency-type: production
applies-to: security-updates
production-major-updates:
dependency-type: production
applies-to: version-updates
update-types:
- major
production-minor-updates:
dependency-type: production
applies-to: version-updates
update-types:
- minor
- patch
development-security:
dependency-type: development
applies-to: security-updates
development-major-updates:
dependency-type: development
applies-to: version-updates
update-types:
- major
development-minor-updates:
dependency-type: development
applies-to: version-updates
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: monday
# Ignore specific dependencies or update types which may cause issues. For example:
# ignore:
# - dependency-name: 'some-package'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if our private dependencies are ignored by default, does that remove the need for the scary "allow bad stuff" config above to be removed?

# - update-types: ['version-update:semver-major']
groups:
production-security:
dependency-type: production
applies-to: security-updates
production-major-updates:
dependency-type: production
applies-to: version-updates
update-types:
- major
production-minor-updates:
dependency-type: production
applies-to: version-updates
update-types:
- minor
- patch
development-security:
dependency-type: development
applies-to: security-updates
development-major-updates:
dependency-type: development
applies-to: version-updates
update-types:
- major
development-minor-updates:
dependency-type: development
applies-to: version-updates
update-types:
- minor
- patch
1 change: 1 addition & 0 deletions lib/generators/rolemodel/github/templates/instructions
18 changes: 18 additions & 0 deletions lib/generators/rolemodel/github/templates/pull_request_template.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there was an open PR for this. I assume we're pulling from there for this?

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Why?

Why were the changes needed? What issues were the changes addressing?
(Note: some changes may seem unrelated to the ticket, this is a great place to explain further.)

## What Changed

What changed in this PR?

* [ ] Change 1

## Pre-merge checklist

* [ ] Update relevant READMEs

## Screenshots

If any UI changes need to be shown off, please add screenshots here.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/rolemodel_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RolemodelRails
VERSION = '0.26.0'
VERSION = '0.27.0'
end
19 changes: 19 additions & 0 deletions spec/generators/rolemodel/github_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,23 @@
expect(content).to include(' host: localhost')
end
end

it 'creates dependabot.yml' do
assert_file '.github/dependabot.yml' do |content|
expect(content).to include('version: 2')
expect(content).to include('package-ecosystem: bundler')
expect(content).to include('directory: /')
expect(content).to include('schedule:')
expect(content).to include('interval: weekly')
expect(content).to include('day: monday')
end
end

it 'creates CODEOWNERS' do
assert_file '.github/CODEOWNERS' do |content|
expect(content).to include('# Dependabot / Dependency reviewers:')
expect(content).to include('# yarn.lock')
expect(content).to include('# Gemfile.lock')
end
end
end