This tool helps updating data for What's New section on the public Adobe Commerce technical documentation resources. It filters GitHub pull requests and generates a data file. One pull request sources one data entity. All filtering parameters are set in a configuration file, except dates. Since date is set as a CLI argument and the till date is always the moment when the command is run.
Commands:
whatsup_github help [COMMAND] # Describe available commands or one specific command
whatsup_github since DATE # Filters pull requests since the specified date till now. Default: last 7 days.
whatsup_github version # Current version of the gem
Usage:
whatsup_github since DATE
Options:
[--config=CONFIG] # Relative path to the configuration file.
# Default: .whatsup.ymlOutput is controlled by output_format in .whatsup.yml, which accepts one or more of:
yaml— writestmp/whats-new.yml.markdown— writes headerless Markdown table rows totmp/whats-new-on-devdocs.mdwith description, versions, type, and date (YYYY-MM-DD). With no matching pull requests, the file is empty.custom— renders rows through a project-supplied Mustache template.
output_format:
- yaml
- custom
templates:
custom: path/to/your-template.mustache
custom_output: tmp/whats-new-custom.txtFor custom, templates.custom must point to a file inside the project directory (relative to where
whatsup_github is run), and custom_output sets the destination path. The template receives
{{#rows}}, each with description, versions, type, date, link, merge_commit, contributor,
and labels.
The fields below describe each row, as produced for the yaml and custom formats.
Text for description is taken from individual pull request's description (same as body).
The text must follow the whatsnew keyword and be located at the end.
Example:
This pull request adds ...
Some other details about this pull request.
whatsnew
Added documentation about [New Magento feature](https://devdocs.magento.com/new-magento-feature.html).Set as a list of labels in .whatsup.yml. There are two types of labels in configuration:
requiredare labels that must includewhatsnew. Otherwise, resulting output will warn about missingwhatsnew.optionalare labels that may includewhatsnew. Ifwhatsnewis missing, you won't get any notification about this.
Generated from pull request labels that begin with one or more digits followed by a period, matching \A\d+\..
Examples: 2.3.x, 1.0.3-msi, 2.x, 12.4.
Matching labels are kept unchanged and joined with a comma and a space in their original order.
For example, labels whatsnew, 2.4, and 12.4 produce 2.4, 12.4.
If no labels match, versions is an empty string.
Date when the pull request was merged.
URL of the pull request. For repos with the enterprise: prefix, the link is
formatted as enterprise:<org>/<repo>/pull/<number> to avoid exposing the
internal hostname.
An author of a pull request.
Merge commit SHA of the pull request.
All labels added to the pull request.
This gem can be installed as a system command-line tool or as a command-line tool available in a project.
gem install whatsup_githubAdd to your Gemfile:
gem 'whatsup_github'And install:
bundleThe default configuration file .whatsup.yml will be
created automatically after first run unless it's already there.
To use non-default location or name of the file, use the --config option. Example:
whatsup_github since 'apr 9' --config 'configs/whatsup_bp.yml'Authentication is checked in this order: environment variables → .env file → ~/.netrc → guest (rate-limited).
Create a .env file in the directory where you run whatsup_github. See .env.example for the format.
WHATSUP_GITHUB_ACCESS_TOKEN=<public-github-token>
WHATSUP_GITHUB_ENTERPRISE_HOSTNAME=<enterprise-hostname>
WHATSUP_ENTERPRISE_ACCESS_TOKEN=<enterprise-github-token>WHATSUP_GITHUB_ACCESS_TOKEN=askk494nmfodic68mk whatsup_github since 'apr 2'WHATSUP_GITHUB_ENTERPRISE_HOSTNAME sets the hostname for GitHub Enterprise Server
(e.g. git.example.com). Optional for GHEC — defaults to github.com.
WHATSUP_ENTERPRISE_ACCESS_TOKEN is used for repos prefixed with enterprise: in
.whatsup.yml. Useful when you need two separate accounts — for example, a public
GitHub account and a GHEC org account.
Use ~/.netrc for
authentication. See .netrc.example for the format.
machine api.github.com
login <github-username>
password <personal-access-token>
For GitHub Enterprise Server (self-hosted), add a second entry using the server hostname:
machine git.enterprise.example.com
login <enterprise-username>
password <enterprise-personal-access-token>
Note:
.netrconly supports one entry per host. If you need two different accounts onapi.github.com(e.g., public GitHub + GHEC), use.envor environment variables instead.
whatsup_github since 'apr 2'To use the default date range of the past 7 days, omit the date:
whatsup_github sinceYou can use different date formats like 'April 2', '2 April', 'apr 2', '2 Apr', 2018-04-02.
To install dependencies:
bin/setupTo install the package:
rake installYou can also run bin/console for an interactive prompt that will allow you to experiment.
The project contains RSpec unit and CLI integration tests in spec.
To run all tests, including offline replay of recorded GitHub API interactions:
bundle exec rakeIn-process specs disable real network access (WebMock) and generate a
SimpleCov coverage report at coverage/index.html.
Subprocess tests exercise executable startup and configuration rejection without making API requests.
To run only CLI integration tests:
bundle exec rspec spec/whatsup_github/cli_integration_spec.rbIntegration tests create their own configuration and output files in temporary directories.
The recorded API test uses VCR with a cassette under
spec/fixtures/cassettes/. Recording is disabled by default, so it runs without live network access.
The existing cassette contains an empty search result; it verifies API replay and empty YAML output,
not rendering of non-empty pull request data. Run it separately with:
bundle exec rspec spec/whatsup_github/cli_integration_spec.rb --example 'recorded GitHub API interactions'To re-record a cassette, delete the corresponding file under spec/fixtures/cassettes/, export a
valid WHATSUP_GITHUB_ACCESS_TOKEN before starting RSpec, and temporarily switch the record mode
from :none to :once in spec/whatsup_github/cli_integration_spec.rb. Run the command above,
then restore :none and review the cassette for sensitive data before committing it.
Individual files can have tests at the end of a file in a format like:
if $PROGRAM_NAME == __FILE__
# test code here
endTo run such test, run the corresponding file:
ruby lib/whatsup_github/config_reader.rb The tests use the root .whatsup.yml file to read configuration.
The tool makes live GitHub API calls, so end-to-end local testing requires real credentials and a real repository.
Copy .env.example to .env and fill in your tokens:
cp .env.example .envA short window keeps the result set small and avoids burning API rate limits:
bundle exec whatsup_github since 'yesterday'Results are written to tmp/whats-new.yml. The tmp/ directory is
gitignored, so test output won't be accidentally committed.
To inspect the exact GitHub search queries being sent, run with DEBUG=1:
DEBUG=1 bundle exec whatsup_github since 'yesterday'Bug reports and pull requests are welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.