diff --git a/.github/workflows/update_api_references.yml b/.github/workflows/update_api_references.yml index 643b8e94c..fbbcbb65b 100644 --- a/.github/workflows/update_api_references.yml +++ b/.github/workflows/update_api_references.yml @@ -1,30 +1,38 @@ name: Update API references on: - pull_request_review: - types: [submitted] + push: + branches: [master] + paths: ['LLama/**'] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: update_api_references: - if: github.event.pull_request.base.ref == 'master' && github.event.review.state == 'approved' + if: github.repository == 'SciSharp/LLamaSharp' name: Update API References runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v6 + with: + token: ${{ secrets.REPO_TOKEN || github.token }} - uses: actions/setup-dotnet@v4 with: dotnet-version: | 8.0.x + 10.0.x - name: install_tool_and_generate_api_docs run: | dotnet tool install -g XMLDoc2Markdown dotnet build ./LLama/LLamaSharp.csproj cd LLama/bin/Debug/net8.0 rm -rf ../../../../docs/xmldocs - dotnet xmldoc2md LLamaSharp.dll -o ../../../../docs/xmldocs --back-button + xmldoc2md LLamaSharp.dll -o ../../../../docs/xmldocs --back-button + # XMLDoc2Markdown 6 also writes the compiler's fixed buffer types, named like e__FixedBuffer, + # which Windows cannot check out + find ../../../../docs/xmldocs -name '*[<>]*' -delete + sed -i '/e__fixedbuffer\.md)/d' ../../../../docs/xmldocs/index.md - name: Commit and push changes run: | @@ -41,6 +49,4 @@ jobs: git diff --cached --name-only git commit -m "chore(docs): update API references in the github action." git push - env: - GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} diff --git a/docs/ContributingGuide.md b/docs/ContributingGuide.md index 2d5103e0f..9009d3e16 100644 --- a/docs/ContributingGuide.md +++ b/docs/ContributingGuide.md @@ -111,11 +111,7 @@ For API references, LLamaSharp takes use of [xmldoc2md](https://github.com/charl ``` dotnet tool install -g XMLDoc2Markdown cd LLama/bin/Debug/net8 # change the path to your bin path. -dotnet xmldoc2md LLamaSharp.dll -o ../../../../docs/xmldocs --back-button +xmldoc2md LLamaSharp.dll -o ../../../../docs/xmldocs --back-button ``` -Specifically, if the xmldoc2md cannot be found by dotnet cli, please replace the `dotnet xmldoc2md` with the executable file, like below. - -``` -C:\Users\liu_y\.dotnet\tools\xmldoc2md.exe LLamaSharp.dll -o ../../../../docs/xmldocs --back-button -``` \ No newline at end of file +XMLDoc2Markdown 6 runs on .NET 10, so the .NET 10 runtime needs to be installed as well. \ No newline at end of file