Skip to content

Commit 679a33c

Browse files
committed
docs: Add latest commit to top of index
Insert `git show --stat HEAD` into the template for the top-level docs, to make it easy to see what a build was generated for. Signed-off-by: David Brown <[email protected]>
1 parent 4c8f3e1 commit 679a33c

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
west build -t rustdoc -b qemu_cortex_m3 docgen
4848
mkdir rustdocs
4949
mv build/rust/target/thumbv7m-none-eabi/doc rustdocs/nostd
50-
cp docs/top-index.html rustdocs/index.html
50+
python3 etc/add-hash.py
5151
5252
- name: Build build documentation
5353
working-directory: zephyr-lang-rust

docs/top-index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
</head>
77
<body>
88
<h1>Documentation Index</h1>
9+
<pre>
10+
{{COMMIT}}
11+
</pre>
912
<ul>
1013
<li><a href="nostd/zephyr/index.html">zephyr crate Documentation</a></li>
1114
<li><a href="std/zephyr_build/index.html">zephyr_build support Documentation</a></li>

etc/add-hash.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#! /usr/bin/env python
2+
3+
import os
4+
import subprocess
5+
6+
input = "./docs/top-index.html"
7+
output = "rustdocs/index.html"
8+
9+
try:
10+
commit_info = subprocess.check_output(["git", "show", "--stat", "HEAD"], text=True)
11+
except subprocess.CalledProcessError as e:
12+
print(f"Error getting commit info: {e}")
13+
commit_info = "Error retrieving commit details.\n"
14+
15+
with open(output, "w") as outfile:
16+
with open(input, "r") as file:
17+
for line in file:
18+
if "{{COMMIT}}" in line:
19+
outfile.write(commit_info)
20+
else:
21+
outfile.write(line)

0 commit comments

Comments
 (0)