Skip to content

Commit

Permalink
Deploying to main from @ KyoriPowered/adventure-docs@5e7c24c 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] committed Oct 2, 2024
0 parents commit 3900eea
Show file tree
Hide file tree
Showing 940 changed files with 169,844 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "cleanup old builds"

on:
schedule:
- cron: '14 1 * * *'
workflow_dispatch:

env:
PYTHON_VERSION: "3.12"

jobs:
cleanup:
runs-on: "ubuntu-latest"
steps:
- name: "checkout"
uses: "actions/[email protected]"
- name: "setup python ${{ env.PYTHON_VERSION }}"
uses: "actions/[email protected]"
with:
python-version: "${{ env.PYTHON_VERSION }}"
cache: "pip"
cache-dependency-path: "_scripts/requirements.txt"
- name: "install dependencies"
run: "pip install -r _scripts/requirements.txt"
- name: "cleanup old PRs"
run: |
git config user.name "kyoripowered-deployment[bot]"
git config user.email "121842021+kyoripowered-deployment[bot]@users.noreply.github.com"
python _scripts/cleanup.py .
git commit -a -m 'cleanup outdated previews' || true
git push
1 change: 1 addition & 0 deletions .nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

50 changes: 50 additions & 0 deletions _scripts/cleanup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env python

import datetime
import dateutil.parser
import json
from pathlib import Path
import shutil


now = datetime.datetime.now(datetime.timezone.utc)
cutoff = now - datetime.timedelta(days = 90)


def stale(pull: Path) -> bool:
info_path = pull / '_preview_data.json'

try:
with info_path.open('rt') as fp:
info = json.load(fp)
except json.JSONDecodeError:
print(f"::error file={info_path.absolute}::Invalid build info for pull #{pull.name}")

pr_time = dateutil.parser.isoparse(info['time'])

return pr_time < cutoff


def cleanup(base: Path, deleted):
for pull in base.iterdir():
if pull.is_dir:
if stale(pull):
shutil.rmtree(pull)
deleted(pull)


if __name__ == "__main__":
from sys import argv
from os import environ
if len(argv) < 2:
print(f"Not enough arguments! Usage: {argv[0]} <repo>")
exit(1)

dest = Path(argv[1]) / 'pull'
if 'GITHUB_STEP_SUMMARY' in environ:
with open(environ['GITHUB_STEP_SUMMARY'], 'at') as fp:
fp.write("# Cleaned up previews\n\n")
cleanup(dest, lambda path: fp.write(f'- `#{path.name}`\n'))
else:
cleanup(dest, lambda _: None)

1 change: 1 addition & 0 deletions _scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-dateutil
4 changes: 4 additions & 0 deletions pull/178/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2c4ce3023419e4190dc5d69216f29373
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added pull/178/_images/click_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/color_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/color_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/color_verbose_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/color_verbose_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/decoration_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/font_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/gradient_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/hover_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/insertion_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/key_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/newline_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/rainbow_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/reset_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/selector_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/tablist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/transition_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/translatable_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pull/178/_images/translatable_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pull/178/_preview_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pr":"178","time":"2024-08-02T18:10:14.372Z"}
101 changes: 101 additions & 0 deletions pull/178/_sphinx_design_static/design-tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// @ts-check

// Extra JS capability for selected tabs to be synced
// The selection is stored in local storage so that it persists across page loads.

/**
* @type {Record<string, HTMLElement[]>}
*/
let sd_id_to_elements = {};
const storageKeyPrefix = "sphinx-design-tab-id-";

/**
* Create a key for a tab element.
* @param {HTMLElement} el - The tab element.
* @returns {[string, string, string] | null} - The key.
*
*/
function create_key(el) {
let syncId = el.getAttribute("data-sync-id");
let syncGroup = el.getAttribute("data-sync-group");
if (!syncId || !syncGroup) return null;
return [syncGroup, syncId, syncGroup + "--" + syncId];
}

/**
* Initialize the tab selection.
*
*/
function ready() {
// Find all tabs with sync data

/** @type {string[]} */
let groups = [];

document.querySelectorAll(".sd-tab-label").forEach((label) => {
if (label instanceof HTMLElement) {
let data = create_key(label);
if (data) {
let [group, id, key] = data;

// add click event listener
// @ts-ignore
label.onclick = onSDLabelClick;

// store map of key to elements
if (!sd_id_to_elements[key]) {
sd_id_to_elements[key] = [];
}
sd_id_to_elements[key].push(label);

if (groups.indexOf(group) === -1) {
groups.push(group);
// Check if a specific tab has been selected via URL parameter
const tabParam = new URLSearchParams(window.location.search).get(
group
);
if (tabParam) {
console.log(
"sphinx-design: Selecting tab id for group '" +
group +
"' from URL parameter: " +
tabParam
);
window.sessionStorage.setItem(storageKeyPrefix + group, tabParam);
}
}

// Check is a specific tab has been selected previously
let previousId = window.sessionStorage.getItem(
storageKeyPrefix + group
);
if (previousId === id) {
// console.log(
// "sphinx-design: Selecting tab from session storage: " + id
// );
// @ts-ignore
label.previousElementSibling.checked = true;
}
}
}
});
}

/**
* Activate other tabs with the same sync id.
*
* @this {HTMLElement} - The element that was clicked.
*/
function onSDLabelClick() {
let data = create_key(this);
if (!data) return;
let [group, id, key] = data;
for (const label of sd_id_to_elements[key]) {
if (label === this) continue;
// @ts-ignore
label.previousElementSibling.checked = true;
}
window.sessionStorage.setItem(storageKeyPrefix + group, id);
}

document.addEventListener("DOMContentLoaded", ready, false);
1 change: 1 addition & 0 deletions pull/178/_sphinx_design_static/sphinx-design.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 3900eea

Please sign in to comment.