Skip to content

Add support for running changelog checks without GitHub API token#65

Merged
dblock merged 3 commits intodblock:masterfrom
numbata:github-tokenless-fallback
Dec 9, 2025
Merged

Add support for running changelog checks without GitHub API token#65
dblock merged 3 commits intodblock:masterfrom
numbata:github-tokenless-fallback

Conversation

@numbata
Copy link
Collaborator

@numbata numbata commented Dec 8, 2025

Summary

  • Adds PRMetadata class to extract PR information from multiple sources: GITHUB_EVENT_PATH (GitHub Actions), the github Danger plugin, or fallback example values
  • Enables running danger dry_run in GitHub Actions without requiring GITHUB_TOKEN or DANGER_GITHUB_API_TOKEN

Motivation

When running bundle exec danger dry_run --base=$BASE_SHA --head=$HEAD_SHA in GitHub Actions, the github plugin is unavailable (uses LocalOnly request source). Previously, this caused errors when generating changelog entry examples.

Now the plugin reads PR metadata from GITHUB_EVENT_PATH first (always available in GitHub Actions without token), then falls back to the github plugin, and finally uses example placeholder values.

This is a part of preparation for ruby-grape/grape#2630 as a part of ruby-grape/grape#2632

Introduce PRMetadata class to extract PR information from multiple sources:
- GITHUB_EVENT_PATH (GitHub Actions, no token required)
- GitHub plugin (traditional Danger with token)
- Fallback example data (local/dry_run)

This allows running `danger dry_run` in GitHub Actions workflows
without requiring GITHUB_TOKEN for changelog validation.
@dblock
Copy link
Owner

dblock commented Dec 9, 2025

👏

I'm going to add you to the gem owners so you can increment the version, make releases.

@dblock dblock merged commit 29831e9 into dblock:master Dec 9, 2025
4 of 6 checks passed
numbata added a commit to numbata/danger-changelog that referenced this pull request Dec 9, 2025
Use 'danger dry_run' which doesn't require GitHub API authentication.
In dry_run mode, the github plugin is unavailable (returns nil), allowing
the danger-changelog plugin to use GITHUB_EVENT_PATH for PR metadata.

This achieves the goal of PR dblock#65 (github-tokenless-fallback) - running
changelog checks without needing any API token or external authentication.

The graceful error handling in PRMetadata.from_github_plugin ensures the
fallback chain works correctly when github plugin is unavailable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants