Skip to content

Commit 26f3835

Browse files
authored
add README; ensure only site_texts path (#5)
1 parent bb5ed2e commit 26f3835

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.github/scripts/sync-changes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ function getFileChanges() {
6161
// Helper function to create PUT options for a file
6262
function createPutOptions(file, content) {
6363
const path = require('path').dirname(file);
64+
if (path !== "site_texts") {
65+
console.error(`❌ The admin config /${path}/ is not currently supported`);
66+
process.exit(1);
67+
}
6468
const filename = require('path').basename(file, require('path').extname(file));
6569
const url = `https://discourse.julialang.org/admin/customize/${path}/${filename}`;
6670

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Discourse Config as Code
2+
3+
This site configures, tracks, and enables collaboration for the "Site Texts" overrides on the [Julia Discourse board](https://discourse.julialang.org).
4+
5+
## Site Texts
6+
7+
The [Site Texts feature of Discourse](https://meta.discourse.org/t/customize-text-in-discourse/36092) allows overriding (and optionally translating) pretty much every and any text that appears on the platform.
8+
9+
These can range from very short slugs (like date formats) to long form (and crucially critical) community resources like the site guidelines. The default admin UI is lacking: not only is it only available to admins, but it also doesn't easily expose diffs and tracing (although there are logs). This repository is an experiment in open-sourcing these overrides.
10+
11+
## Other admin settings
12+
13+
Would similarly be possible, but may be even more dangerous and are currently not supported.
14+
15+
## How it works
16+
17+
This repo has a GitHub action that — upon commit to `main` — uses the Discourse API to identify the files that changed in the HEAD commit. GitHub branch restrictions should ensure that only one commit lands at a time. These files are used as the slug names, with their contents as the content of the override.
18+
19+
The GitHub action does not perform the API call in pull requests; it only performs the API call upon commiting to `main`. All PRs must be carefully reviewed and if the action fails on `main`, then that commit should be reverted.

0 commit comments

Comments
 (0)