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
30 changes: 3 additions & 27 deletions .github/workflows/danger-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,9 @@ on:
workflow_run:
workflows: [Danger]
types: [completed]

permissions:
actions: read
contents: read
issues: write
pull-requests: write
workflow_call:
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The workflow_call trigger has been added, but this workflow doesn't appear to be called by any other workflows in the repository based on the PR changes. If this trigger is intended for future use or external calls, consider adding a comment explaining its purpose. Otherwise, it may be unnecessary and could be removed to keep the configuration minimal.

Suggested change
workflow_call:

Copilot uses AI. Check for mistakes.

jobs:
comment:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download Danger Report
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: danger-report
run-id: ${{ github.event.workflow_run.id }}
repository: ${{ github.event.workflow_run.repository.full_name }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Post or Update PR Comment
uses: actions/github-script@v7
with:
script: |
const script = require('./.github/scripts/post-danger-comment.js');
await script({ github, context, core });
uses: ruby-grape/danger/.github/workflows/danger-comment.yml@report-workflows
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The workflow references a specific branch (@report-workflows) of the reusable workflow. While this is appropriate for testing during development, consider updating this to reference a stable version tag or the main branch once the ruby-grape-danger repository's report-workflows branch is merged and released. Using branch references can lead to unexpected changes if the upstream branch is modified.

Suggested change
uses: ruby-grape/danger/.github/workflows/danger-comment.yml@report-workflows
uses: ruby-grape/danger/.github/workflows/danger-comment.yml@main

Copilot uses AI. Check for mistakes.
secrets: inherit
30 changes: 4 additions & 26 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,9 @@ name: Danger
on:
pull_request:
types: [ opened, reopened, edited, synchronize ]
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The workflow_call trigger has been added, but this workflow doesn't appear to be called by any other workflows in the repository based on the PR changes. If this trigger is intended for future use or external calls, consider adding a comment explaining its purpose. Otherwise, it may be unnecessary and could be removed to keep the configuration minimal.

Suggested change
types: [ opened, reopened, edited, synchronize ]
types: [ opened, reopened, edited, synchronize ]
# Expose this workflow so it can be invoked by other workflows via `workflow_call` (current or future use).

Copilot uses AI. Check for mistakes.
workflow_call:

jobs:
danger:
name: Danger
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run Danger
# Note: We use 'dry_run' mode intentionally as part of a two-workflow pattern.
# The actual commenting on GitHub is handled by the danger-comment.yml workflow.
run: bundle exec danger dry_run --verbose
env:
DANGER_REPORT_PATH: danger_report.json
- name: Upload Danger Report
if: always()
uses: actions/upload-artifact@v4
with:
name: danger-report
path: danger_report.json
retention-days: 1
if-no-files-found: ignore
uses: ruby-grape/danger/.github/workflows/danger-run.yml@report-workflows
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The workflow references a specific branch (@report-workflows) of the reusable workflow. While this is appropriate for testing during development, consider updating this to reference a stable version tag or the main branch once the ruby-grape-danger repository's report-workflows branch is merged and released. Using branch references can lead to unexpected changes if the upstream branch is modified.

Suggested change
uses: ruby-grape/danger/.github/workflows/danger-run.yml@report-workflows
uses: ruby-grape/danger/.github/workflows/danger-run.yml@main

Copilot uses AI. Check for mistakes.
secrets: inherit
30 changes: 3 additions & 27 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
# danger.systems

toc.check!
changelog.check!

# Export report for danger-comment workflow
require 'json'
event_path = ENV.fetch('GITHUB_EVENT_PATH', nil)
report_path = ENV.fetch('DANGER_REPORT_PATH', nil)
if report_path && event_path && File.exist?(event_path)
event = JSON.parse(File.read(event_path))
pr_number = event.dig('pull_request', 'number')
if pr_number
to_messages = lambda do |items|
Array(items).map do |item|
item.respond_to?(:message) ? item.message : item.to_s
end
end
# Import ruby-grape-danger for automatic danger report export
danger.import_dangerfile(gem: 'ruby-grape-danger')

report = {
pr_number: pr_number,
errors: to_messages.call(status_report[:errors]),
warnings: to_messages.call(status_report[:warnings]),
messages: to_messages.call(status_report[:messages]),
markdowns: to_messages.call(status_report[:markdowns])
}

File.write(report_path, JSON.pretty_generate(report))
end
end
changelog.check!
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The toc.check! call has been removed from the Dangerfile. Since danger-toc is still a dependency in the Gemfile (line 8), this appears to be an intentional removal of the table of contents check. If this check is no longer needed, consider also removing the danger-toc gem dependency from the Gemfile to keep dependencies clean and reduce the project's dependency footprint.

Suggested change
changelog.check!
changelog.check!
toc.check!

Copilot uses AI. Check for mistakes.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ group :development, :test do
gem 'rubocop', '~> 1.63.1'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'ruby-grape-danger'
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The ruby-grape-danger gem is added without a version constraint or Git source specification. According to the PR description, this should reference the report-workflows branch from the ruby-grape-danger gem repository for testing purposes. Without specifying the source, this will attempt to install from rubygems.org where the gem may not exist or may not have the required functionality.

Consider adding a Git source specification, for example:

gem 'ruby-grape-danger', git: 'https://github.com/ruby-grape/danger', branch: 'report-workflows'
Suggested change
gem 'ruby-grape-danger'
gem 'ruby-grape-danger', git: 'https://github.com/ruby-grape/danger', branch: 'report-workflows'

Copilot uses AI. Check for mistakes.
gem 'yard', '~> 0.9.11'
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ changelog.filename = 'CHANGES.md'

### changelog.format

Set the format of the CHANGELOG file.
Set the format of the CHANGELOG file.

```ruby
changelog.format = :keep_a_changelog
Expand Down