diff --git a/.github/workflows/add-tools-api-docs.yml b/.github/workflows/add-tools-api-docs.yml new file mode 100644 index 0000000000..546f923324 --- /dev/null +++ b/.github/workflows/add-tools-api-docs.yml @@ -0,0 +1,80 @@ +name: Open PR with tools API docs based on webhook call +on: + workflow_dispatch: + inputs: + ref_name: + description: 'The name of the release branch' + required: true + default: 'dev' + +jobs: + api-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Checkout tools code + uses: actions/checkout@v4 + with: + repository: 'nf-core/tools' + ref: ${{ inputs.ref_name }} + path: 'tools' + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: | + npm install remark unist-util-visit + + - name: run API generation script + run: | + cd tools + bash docs/api/generate-api-docs.sh --release ${{ inputs.ref_name }} + + # Install and run pre-commit + - uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5 + with: + python-version: 3.11 + + # install prettier plugins + - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4 + with: + node-version: 20 + + - run: npm install --only=dev + + - name: Install pre-commit + run: pip install pre-commit + + - name: Run pre-commit + id: pre-commit + run: pre-commit run --all-files + continue-on-error: true + + - name: Commit & push changes + id: commit-and-push + run: | + git config user.email "core@nf-co.re" + git config user.name "nf-core-bot" + git config push.default upstream + git add . + git status + git commit -m "[automated] Update nf-core/tools API docs for ${{ inputs.ref_name }}" + git push + + - name: Create PR + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update nf-core/tools API docs for ${{github.ref_name}} + title: Update nf-core/tools API docs for ${{github.ref_name}} + body: | + This PR updates the nf-core/tools API docs for ${{github.ref_name}}. + Please review the changes and merge if they look good. + branch: 'update-api-docs-${{github.ref_name}}' + delete-branch: true + base: 'main' + draft: false diff --git a/astro.config.mjs b/astro.config.mjs index 858aab3785..b1c4065743 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -30,34 +30,40 @@ import icon from "astro-icon"; const latestToolsRelease = await fetch('https://api.github.com/repos/nf-core/tools/releases/latest') .then((res) => res.json()) .then((json) => json.tag_name); -let latestPipelineReleases = {}; +let latestPipelineReleases = {}; pipelines_json.remote_workflows.map( (pipeline) => (latestPipelineReleases[pipeline.name] = `/${pipeline.name}/${pipeline.releases[0].tag_name}/`), ); -const latestTollsURL = `/tools/docs/'+${latestToolsRelease}`; // https://astro.build/config export default defineConfig({ site: 'https://nf-co.re/', output: 'hybrid', adapter: netlify(), redirects: { - [latestTollsURL]: 'https://oldsite.nf-co.re/tools/docs/latest/', ...latestPipelineReleases, }, integrations: [ svelte(), icon({ - include:{ - // only include a subset of icons - "file-icons":["nextflow"], - logos:["twitter","mastodon-icon","slack-icon","aws","microsoft-azure","github-actions", "youtube-icon"], - fa:["github"], - "fa-brands":["github"], - "line-md":["check-list-3-twotone"], - "mdi":["aws","slack","youtube"], - octicon:["link-external-16","table-16"], - } + include: { + // only include a subset of icons + 'file-icons': ['nextflow'], + logos: [ + 'twitter', + 'mastodon-icon', + 'slack-icon', + 'aws', + 'microsoft-azure', + 'github-actions', + 'youtube-icon', + ], + fa: ['github'], + 'fa-brands': ['github'], + 'line-md': ['check-list-3-twotone'], + mdi: ['aws', 'slack', 'youtube'], + octicon: ['link-external-16', 'table-16'], + }, }), sitemap(), prefetch(), @@ -190,7 +196,7 @@ export default defineConfig({ theme: { dark: 'github-dark', light: 'github-light', - } + }, }, ], rehypeKatex, diff --git a/public/_redirects b/public/_redirects index a4162e200e..4567883800 100644 --- a/public/_redirects +++ b/public/_redirects @@ -3,9 +3,6 @@ # Temporary oldsite redirections /logo/* https://oldsite.nf-co.re/logo/:splat 200 - -/tools-docs/lint_tests/* https://oldsite.nf-co.re/tools/docs/latest/pipeline_lint_tests/:splat -/tools/docs/* https://oldsite.nf-co.re/tools/docs/:splat /pipeline_schema_builder/* https://oldsite.nf-co.re/pipeline_schema_builder/:splat 200 /launch/* https://oldsite.nf-co.re/launch/:splat 200 /assets/* https://oldsite.nf-co.re/assets/:splat 200 @@ -16,4 +13,5 @@ /developers/* /docs/contributing/:splat /contributing/* /docs/contributing/:splat /assets/img/* /images/:splat +/tools-docs/lint_tests/* /tools/docs/latest/pipeline_lint_tests/:splat diff --git a/src/components/navbar/Navbar.astro b/src/components/navbar/Navbar.astro index b90531bfae..e4efc5812b 100644 --- a/src/components/navbar/Navbar.astro +++ b/src/components/navbar/Navbar.astro @@ -107,6 +107,9 @@ newBlogPost = await getCollection('blog').then((posts) => {
  • Configs & tools
  • Shared configs
  • Tools
  • +
  • + Linting Errors +
  • ); })} @@ -185,4 +185,17 @@ url = url.replace(/\.html$/, ''); } } } + // show only the active section + .nav.accordion { + ul { + display: none; + } + h6:has(.active) ~ ul, + ul:has(.active) { + display: block; + } + div.mb-3:not(:has(.active)) { + margin-bottom: 0 !important; + } + } diff --git a/src/components/sidebar/SidebarToc.svelte b/src/components/sidebar/SidebarToc.svelte index 4af946fe8b..d9a4b9ebac 100644 --- a/src/components/sidebar/SidebarToc.svelte +++ b/src/components/sidebar/SidebarToc.svelte @@ -24,7 +24,7 @@ // make margin classes from min to max heading depth let headingMargin = {}; for (let i = minHeadingDepth; i <= 4; i++) { - headingMargin[i] = 'ps-' + (i - minHeadingDepth) * 2; + headingMargin[i] = 'ps-' + (i - minHeadingDepth); } let activeHeading = {}; onMount(() => { @@ -47,7 +47,7 @@