Skip to content

Commit

Permalink
Add header, track build ref
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Jan 11, 2025
1 parent a6ad9cb commit 594d9bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
run: |
chmod +x ./restylers-docs
./restylers-docs restylers.yaml > _docs/restylers.md
./restylers-docs $GH_REF restylers.yaml > _docs/restylers.md
git config user.name "github-actions[bot]"
git config user.email "[email protected]"
Expand All @@ -180,6 +180,8 @@ jobs:
fi
git push
env:
GH_REF: ${{ github.ref }}

release:
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
6 changes: 3 additions & 3 deletions _tools/restylers-docs/src/Restylers/Docs/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ main :: IO ()
main = do
args <- getArgs
case args of
[path] -> do
[ref, path] -> do
restylers <- Yaml.decodeFileThrow path
T.putStrLn $ renderDocs restylers
T.putStrLn $ renderDocs (pack ref) restylers
_ -> do
hPutStrLn stderr "Usage: restyler-docs <manifest>"
hPutStrLn stderr "Usage: restyler-docs <ref> <manifest>"
exitWith $ ExitFailure 64
15 changes: 12 additions & 3 deletions _tools/restylers-docs/src/Restylers/Docs/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,22 @@ import Restylers.Manifest (Restyler (..))
import Restylers.Name (RestylerName (..))
import Text.Shakespeare.Text (st)

renderDocs :: [Restyler] -> Text
renderDocs restylers =
renderDocs :: Text -> [Restyler] -> Text
renderDocs ref restylers =
T.unlines
$ restylersTable restylers
$ [header ref]
<> restylersTable restylers
<> ["---"]
<> map restylerSection restylers

header :: Text -> Text
header ref =
[st|
# Restylers

Built from `#{ref}`
|]

restylersTable :: [Restyler] -> [Text]
restylersTable restylers = headerRows <> map restylerTableRow restylers
where
Expand Down

0 comments on commit 594d9bb

Please sign in to comment.