Official upstream source mirror. Do not make UH changes here.
  • Ruby 87.7%
  • Jsonnet 11.9%
  • Shell 0.2%
  • HTML 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ynda Jas 328b543a28
Merge pull request #4205 from alphagov/remove-missing-update-type-alert
[PP-7989] Remove unactioned missing update_type alert
2026-09-28 17:12:40 +01:00
.github build(deps): bump ruby/setup-ruby from 1.321.0 to 1.324.0 2026-09-22 07:03:29 +00:00
app Remove unactioned missing update_type alert 2026-09-28 17:00:04 +01:00
bin Add binstubs 2026-04-14 14:11:36 +01:00
config Add collector to export Sidekiq lock metrics 2026-06-02 12:44:20 +01:00
content_schemas Regenerate schemas 2026-09-23 16:31:10 +01:00
db Update Rails database schema for 8.1 2026-04-09 09:04:59 +01:00
docs Remove GraphQL references from the docs on adding and updating content schemas 2026-09-14 10:56:04 +01:00
lib Revert "Fix legacy path reservations for /guidance/* [WHIT-3973]" 2026-09-03 09:43:03 +01:00
log Bare Rails application 2015-07-29 15:15:20 +01:00
script Autocorrect rubocop offences 2026-04-17 12:59:42 +01:00
spec Remove unactioned missing update_type alert 2026-09-28 17:00:04 +01:00
.dockerignore Remove obsolete Jenkinsfile. 2024-01-31 16:20:48 +00:00
.gitignore Sample editions for GraphQL validation 2025-10-28 11:39:09 +00:00
.govuk_dependabot_merger.yml Upgrade govuk_dependabot_merger config to use v2 2024-04-30 10:49:36 +01:00
.rspec Parallelise GraphQL link expansion tests 2026-02-19 00:56:35 +00:00
.rspec.benchmark Add RSpec formatter to report benchmark stats 2025-11-05 12:16:47 +00:00
.rubocop.yml Add production_replica environment to rubocop 2025-03-18 12:27:28 +00:00
.ruby-version Update ruby to version 4.0.6 2026-07-21 13:34:32 +01:00
.sqlfluff Reformat linked_to_editions.sql for sqlfluff 2025-11-13 14:39:52 +00:00
config.ru Run app:update task 2021-10-26 10:47:10 +01:00
Dockerfile Update Ruby to 4.0.2 2026-04-14 14:06:47 +01:00
Gemfile Bump rails to 8.1.3.1 2026-08-03 12:05:46 +01:00
Gemfile.lock Merge pull request #4203 from alphagov/dependabot/bundler/bunny-3.4.0 2026-09-22 09:55:17 +01:00
LICENCE Rename Licence reference in README 2022-12-02 15:14:45 +00:00
Procfile Use unicorn in the procfile 2018-01-31 11:43:09 +00:00
Rakefile Configure CI to publish pacts to broker 2023-11-08 09:45:42 +00:00
README.md Introduce sqlfluff 2025-11-13 14:39:41 +00:00
requirements.txt build(deps): update sqlfluff requirement from ==4.2.* to ==4.3.* 2026-08-11 07:05:35 +00:00

Publishing API

The Publishing API aims to provide workflow as a service so that common publishing features can be written once and used by all publishing applications across Government. Content can be stored and retrieved using the API and workflow actions can be performed, such as creating a new draft or publishing an existing piece of content.

Publishing API sends content downstream to the draft and live Content Stores, as well as on a Rabbit message queue, which enables things like sending emails to users subscribed to that content. Read "Downstream Sidekiq background processing triggered by publishing".

Nomenclature

  • Document: A document is a piece of content in a particular locale. It is associated with editions that represent the versions of the document.
  • Edition: The content of a document is represented by an edition, it represents a distinct version of a Document.
  • Content Item: A representation of content that can be sent to a content store.
  • Links: Used to capture relationships between pieces of content (e.g. parent/child). Can be of type link set link or edition link.
  • Unpublishing: An object indicating a previously published edition which has been removed from the live site.
  • User: A user of the system, which is used to track who initiated requests and to restrict access to draft content.
  • Path Reservation: An object that attributes a path on GOV.UK to a piece of content. It is used when paths need to be reserved before that content enters the system.
  • Event Log: A log of all requests to the Publishing API that have the potential to mutate its internal state.
  • Action: A record of activity on a particular edition, used to assist custom workflows of publishing applications.
  • Link Expansion: A process that converts the stored and automatic links for an edition into a JSON representation.
  • Dependency Resolution: A process that determines other editions that require updating downstream as a result of a change to an edition.

Technical documentation

This is a Ruby on Rails app, and should follow our Rails app conventions.

You can use the GOV.UK Docker environment to run the application and its tests with all the necessary dependencies. Follow the usage instructions to get started.

Use GOV.UK Docker to run any commands that follow.

Running the test suite

You can run the tests locally with: bundle exec rake.

The Publishing API also has contract tests with GDS API Adapters (where it acts as the "provider") and with Content Store ( where it acts as the contract "consumer"). Read the guidance for how to run the tests locally.

Linting

Like all GOV.UK's Rails apps, we use rubocop for linting Ruby.

We also have SQL linting using SQLFluff. You can install this locally with brew install sqlfluff. Use sqlfluff lint to check the SQL passes the rules, or sqlfluff fix to automatically fix any issues that can be.

Profiling and Benchmarks

In development mode, you can use rack-mini-profiler to get performance information (such as flamegraphs). There's full documentation in the gem's readme, but often it's as simple as appending

pp=flamegraph

to the query string.

There is also a suite of benchmarks, written with RSpec. These require a full database (e.g. a dump of integration), and are intended to be run manually on a developer's workstation. Run them with:

bundle exec rspec --options .rspec.benchmark

The benchmarks will output various statistics to the console, as well as:

  • timings for all SQL queries and govspeak renders in tmp/benchmarks/instrumentation
  • StackProf profiles (which can be viewed using https://speedscope.app) in tmp/benchmarks/profiles
  • SQL query plans for any queries slower than the threshold set in the benchmarks in tmp/benchmarks/sql

Further documentation

Licence

MIT License