Skip to content

Add import statement #472

Add import statement

Add import statement #472

name: "Dispatch"
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
repository_dispatch:
types: [update_pl_docs]
workflow_dispatch:
inputs:
generate_docs:
description: "Regenerate docs"
required: false
type: boolean
jobs:
tests:
name: 📄 Update Pattern Language Documentation
runs-on: ubuntu-22.04
steps:
- name: 🧰 Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: ⬇️ Download plcli
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: build.yml
workflow_conclusion: success
branch: master
event: push
name: plcli Linux
repo: WerWolv/PatternLanguage
check_artifacts: false
search_artifacts: false
if_no_artifact_found: fail
- name: 🖋️ Regenerate Documentation
run: |
# Clone ImHex-Patterns repo
git clone https://github.com/WerWolv/ImHex-Patterns
# Make plcli executable
chmod +x ./usr/bin/plcli
# Generate new documentation
for f in $(find ./ImHex-Patterns/includes -not -path '*/impl/*' -name '*.pat' -or -name '*.hexpat'); do
echo $f
./usr/bin/plcli docs --includes ./ImHex-Patterns/includes --define __IMHEX__ --noimpls $f out/$f.md
done
# Delete all existing library docs
for f in $(find ./ImHex-Patterns/includes -name '*.pat.md' -or -name '*.hexpat.md'); do
rm $f
done
# Copy over generated folders to output
rsync -a ./out/ImHex-Patterns/includes/ ./pattern_language/libraries
# Generate Table of Content
toc=""
pushd pattern_language
for d in libraries/*/ ; do
echo $d
toc="${toc}* [$(basename $d)](${d}README.md)\n"
for f in $(find ${d} -name "*.pat.md"); do
toc="${toc} * [$(basename $f .pat.md)](${f})\n"
done
done
popd
toc="<!-- LIBRARIES START -->\n\n${toc}"
perl -i -0777 -pe "s|<!-- LIBRARIES START -->.*?(?=<!-- LIBRARIES END -->)|${toc}|s" ./pattern_language/SUMMARY.md
# Cleanup
rm -rf ImHex-Patterns
rm -rf "plcli Linux.zip"
rm -rf out
rm -rf usr
- name: ⬆️ Commit changes
uses: EndBug/add-and-commit@v9
with:
add: './pattern_language'
message: Updated Pattern Language Libraries documentation
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com