Skip to content

Add opennews-rake-tasks Ruby gem#3

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-opennews-rake-tasks-gem
Draft

Add opennews-rake-tasks Ruby gem#3
Copilot wants to merge 2 commits intomainfrom
copilot/add-opennews-rake-tasks-gem

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 26, 2026

Packages the shared Rake tasks from opennews-website into a opennews-rake-tasks gem living in this repo, giving all OpenNews Jekyll sites a single DRY source for build, test, review, format, and outdated-check logic.

Structure

  • opennews-rake-tasks.gemspec — gem spec; runtime deps: rake ~> 13.0, jekyll ~> 4.3, html-proofer ~> 5.0
  • lib/opennews/rake_tasks/version.rbVERSION = "0.1.0"
  • lib/opennews/rake_tasks/configuration.rbConfiguration class + OpenNews::RakeTasks.configure { } API; holds all repo-specific-by-default lists (html-proofer ignore URLs/files, external-link ignore lists, required files)
  • lib/opennews/rake_tasks.rb — auto-loads all .rake files in lib/opennews/rake_tasks/
  • lib/opennews/rake_tasks/build.rakevalidate_yaml, check, build, serve, clean
  • lib/opennews/rake_tasks/test.raketest + test:{html_proofer,templates,page_config,placeholders,a11y,performance}
  • lib/opennews/rake_tasks/review.rakereview:external_links (configurable ignore lists), review:compare_deployed_sites
  • lib/opennews/rake_tasks/format.rakelint, format, format:ruby*, format:prettier*
  • lib/opennews/rake_tasks/outdated.rakeoutdated, outdated:direct, outdated:all
  • README.md — setup (RubyGems / git source / GitHub Packages / separate repo options + pros/cons table), usage, and extensibility docs

Scope notes

  • deploy:* tasks are intentionally excluded — they read per-repo S3 bucket names from _config.yml and belong in each consuming repo's own Rakefile.
  • Tasks that depend on site-specific ignore lists (test:html_proofer, review:external_links) and required-file checks (check) read from OpenNews::RakeTasks.configuration at runtime, so consumer repos override only what differs.

Consumer usage

# Gemfile
gem "opennews-rake-tasks"

# Rakefile — one line loads all tasks
require "opennews/rake_tasks"

# Optional: extend defaults for this repo
OpenNews::RakeTasks.configure do |config|
  config.html_proofer_ignore_urls += [/my-blocked-domain\.com/]
  config.external_links_ignore_urls += [/etherpad\.mozilla\.org/]
  config.required_files -= ["package.json"]  # repos with no npm tooling
end
Original prompt

Start the process of packaging shared/deduplicated Rake tasks as a Ruby gem for use by OpenNews static site (Jekyll) repos. This is a separate PR from the YAML GitHub Actions work, per instruction.

Goals

  • Move general-purpose Jekyll/project Rake tasks from opennews-website (and similar) into a gem in this repo (opennews-actions) for DRY developer experience.
  • All generic, repo-agnostic Ruby code: validation, check, build, serve, clean, format, outdated, and most of the test/review logic. Tasks that rely on repo-specific ignore lists/configs must be implemented so consumer repos can override or extend.
  • Consumers load these tasks via require 'opennews/rake_tasks' or equivalent.
  • DO NOT touch/disturb any unrelated code in the repo.

Files to add:

  • opennews-rake-tasks.gemspec
  • lib/opennews/rake_tasks/version.rb
  • lib/opennews/rake_tasks.rb (loads all .rake in lib/opennews/rake_tasks/)
  • lib/opennews/rake_tasks/ (copy over deduplicated/robust versions of Rake task files from opennews-website/tasks/ and any reusable chunk of Rakefile logic)
  • LICENSE (MIT, copy from opennews-website)
  • README.md (setup, upgrade, usage, extensibility for site-specific extensions)

Bring over the following pros/cons options table from prior discussion (verbatim):

Option Pros Cons
RubyGems public gem Most standard; Dependabot works out of the box; easy for public and private repos Requires publish & version management; possibly public
GitHub Packages gem Keeps in-org; works for private repos Requires token config in Gemfile; lock-in to GH infra
GitHub-only (gem '...', github:) No publish step, easy to update from HEAD or tag Ties Gemfile to repo structure; Dependabot may not fully support
Separate opennews-rake-tasks repo Clean separation, can be public or private One more repo to track/maintain

Constraints

  • No .github/workflows or other Actions/YAML files in this PR
  • All Gem/Rake work stays scoped to lib/ and gemspec/README.md, no ops logic changed
  • Source: opennews-website/tasks, Rakefile, and prior discussion on "4. Rake task consolidation"

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: The following public GitHub repos for OpenNews/ have been upgraded to pretty much the same core GitHub Actions based deploy mechanisms, rake tasks and developer-experience configuration files. It's repetitive and rife for code and functionality drift and should be consolidated into a Shared Composite Action.

Plan that action, if I were to upgrade the repos that still have Travis driving CI/CD work to follow the patterns in the latest Actions-focused upgrades but try to consolidate fixes and upgrades to a Shared Composition Action repo for the Org.

Upgraded to Actions:

  • OpenNews/opennews-website
  • OpenNews/srccon-site-starterkit
  • OpenNews/srccon
  • OpenNews/srccon-2026

In need of upgrade:

  • OpenNews/datainstitute-website
  • OpenNews/knight-eta-2024-website
  • OpenNews/etherpad-lite

Assistant: Good. I have enough context. Let me now produce the plan.


Findings

datainstitute-website and knight-eta-2024-website share an identical .travis.yml (same SHA: 4bf053584de65dc1244f93e6a1b76ce5bbf28545). Decoded, the Travis config is:

language: ruby
os: linux
dist: xenial
jdk: openjdk8
rvm:
- 3.1.2
install: gem install jekyll -v 4.1.0 && gem install jekyll-redirect-from && gem install
  s3_website_revived
script: jekyll build
after_success:
- test $TRAVIS_BRANCH = "staging" && s3_website push --config-dir=_config/staging/
- test $TRAVIS_BRANCH = "main" && s3_website push --config-dir=_config/production/
branches:
  only:
  - staging
  - main

Both repos use s3_website_revived gem (not AWS CLI + OIDC), separate _config/staging/ and _config/production/ directories for S3 config, Ruby 3.1.2 on Xenial (EOL), and no Bundler/Gemfile — bare gem install.

etherpad-lite has a .travis.yml (5391 bytes — a Node.js/test matrix, not a Jekyll deploy). It has an existing .github/ directory. This repo is fundamentally different: it's a Node.js application, not a Jekyll static site. It should be treated separately and is out of scope for the Jekyll Composite Action.


Prompt revision note

"Shared Composite Action" is the correct term. You may also want to specify whether this is a reusable workflow (called with workflow_call) or a composite action (called with uses:). These are different GitHub Actions primitives with different tradeoffs. The plan below covers both where relevant.


Plan: OpenNews Shared Composite Action

1. What to extract — the repeated surface area

Across opennews-website, srccon...

This pull request was created from Copilot chat.


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

- opennews-rake-tasks.gemspec
- lib/opennews/rake_tasks/version.rb
- lib/opennews/rake_tasks/configuration.rb (configurable ignore lists)
- lib/opennews/rake_tasks.rb (auto-loader)
- lib/opennews/rake_tasks/build.rake (validate_yaml, check, build, serve, clean)
- lib/opennews/rake_tasks/test.rake (test namespace)
- lib/opennews/rake_tasks/review.rake (review namespace)
- lib/opennews/rake_tasks/format.rake (lint/format)
- lib/opennews/rake_tasks/outdated.rake
- README.md updated with setup/usage/extensibility docs

Agent-Logs-Url: https://github.com/OpenNews/opennews-actions/sessions/840ec618-51e2-4c58-bacf-8c9450b7f589

Co-authored-by: tiffehr <60173+tiffehr@users.noreply.github.com>
Copilot AI changed the title [WIP] Add packaging for shared Rake tasks as Ruby gem Add opennews-rake-tasks Ruby gem Mar 26, 2026
Copilot AI requested a review from tiffehr March 26, 2026 19:05
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