From 290d8f5ec4ed671409235a6d74fd559c4fd49ea8 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Thu, 28 May 2026 13:01:44 +0200 Subject: [PATCH 01/18] docs: install package rtd --- .readthedocs.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 99d008d..8c09052 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -30,3 +30,8 @@ sphinx: python: install: - requirements: docs/requirements.txt + - method: pip + path: . + extra_requirements: + - docs + From 4e6c774ff4502d438722991b692c956cc686258f Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Thu, 28 May 2026 13:09:32 +0200 Subject: [PATCH 02/18] docs: build notebooks on rtd --- .readthedocs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 8c09052..b1e9ab8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -16,6 +16,8 @@ build: jobs: pre_build: - sphinx-apidoc . -o docs/api + - jupytext --to ipynb --pipe black --execute docs/md_docs/*.md + - mv docs/md_docs/*.ipynb docs/notebooks # Build documentation in the "docs/" directory with Sphinx sphinx: From 7d43816eb909ea1da07207a39b777f672f57c7bc Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Thu, 28 May 2026 13:11:27 +0200 Subject: [PATCH 03/18] docs: missing docs dependency --- docs/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/requirements.txt b/docs/requirements.txt index b5907a8..d21a0e8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,3 +8,4 @@ sphinx-copybutton sphinxcontrib-email jupytext furo +black From 3c3093052c66caf5949f9f33317302fa97e0a12c Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Thu, 28 May 2026 13:27:58 +0200 Subject: [PATCH 04/18] docs: rename kernel name --- docs/md_docs/converter.md | 2 +- docs/md_docs/crab_spectrum.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/md_docs/converter.md b/docs/md_docs/converter.md index 9554f34..fda9566 100644 --- a/docs/md_docs/converter.md +++ b/docs/md_docs/converter.md @@ -9,7 +9,7 @@ jupyter: kernelspec: display_name: threeML language: python - name: threeml + name: python3 --- # Converting a astromodels Model diff --git a/docs/md_docs/crab_spectrum.md b/docs/md_docs/crab_spectrum.md index 6ecdbaa..7aab875 100644 --- a/docs/md_docs/crab_spectrum.md +++ b/docs/md_docs/crab_spectrum.md @@ -9,7 +9,7 @@ jupyter: kernelspec: display_name: threeML language: python - name: threeml + name: python3 --- # Spectrum Fitting From 7630972411483cb6d7e3972973e4a83b474acb6f Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 09:21:47 +0200 Subject: [PATCH 05/18] chore: clean up rtd config --- .readthedocs.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b1e9ab8..c613caa 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -1,34 +1,21 @@ # Read the Docs configuration file for Sphinx projects # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details -# Required version: 2 -# Set the OS, Python version and other tools you might need build: os: ubuntu-24.04 tools: python: "3.12" - # You can also specify other tool versions: - # nodejs: "20" - # rust: "1.70" - # golang: "1.20" jobs: pre_build: - sphinx-apidoc . -o docs/api - - jupytext --to ipynb --pipe black --execute docs/md_docs/*.md - - mv docs/md_docs/*.ipynb docs/notebooks # Build documentation in the "docs/" directory with Sphinx sphinx: configuration: docs/conf.py fail_on_warning: false -# Optionally build your docs in additional formats such as PDF and ePub -# formats: -# - pdf -# - epub - python: install: - requirements: docs/requirements.txt From fe094b0a99fd49835837e68435a696b063805106 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 13:30:02 +0200 Subject: [PATCH 06/18] ci: add building jupytext job --- .github/workflows/docs.yml | 152 ++++++------------------------------- 1 file changed, 24 insertions(+), 128 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 6e6e765..86caf53 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,8 +1,23 @@ name: Docs -on: [release] +on: + push: + branches: + - main + - dev + tags: + - "v*" + pull_request: + branches: + - main + - dev + release: + +permissions: + contents: write # 'write' access to repository contents + pull-requests: write # 'write' access to pull requests jobs: - notebooks: + build-notebooks: name: "Build the notebooks for the docs" runs-on: ubuntu-latest steps: @@ -10,143 +25,24 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: 3.11 - - uses: conda-incubator/setup-miniconda@v4 - with: - auto-activate-base: true - activate-environment: "" - auto-update-conda: true - python-version: ${{ matrix.python-version }} - channels: conda-forge, threeml, defaults - + python-version: 3.13 - name: Install dependencies run: | - python -m pip install --upgrade pip wheel - pip install numpy==2.1 - pip install matplotlib==3.8.4 - pip install black - pip install ipython jupyter cython astropy - conda install jupytext jupyterthemes emcee pymultinest ultranest nbconvert ipykernel astropy regions threeML astromodels gammapy - pip install . + pip install -e . + pip install -r docs/requirements.txt - name: Execute the notebooks shell: bash -l {0} run: | - pip install . - export GAMMAPY_DATA=$HOME/data + export GAMMAPY_DATA="/home/runner/work/gammapy_data" mkdir -p $GAMMAPY_DATA git clone https://github.com/gammapy/gammapy-data.git $GAMMAPY_DATA - jupytext --to ipynb --pipe black --execute docs/md/*.md + jupytext --to ipynb --pipe black --execute docs/md_docs/*.md mkdir -p docs/notebooks - mv docs/md/*.ipynb docs/notebooks + mv docs/md_docs/*.ipynb docs/notebooks + echo "Next - uploading artifacts for sha ${{ github.sha }}" - uses: actions/upload-artifact@v6 with: name: notebooks-for-${{ github.sha }} path: docs/notebooks - - api_doc: - name: "Create the API stubs" - runs-on: macos-latest - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: 3.11 - - - name: Build the API doc - run: | - - brew install c-blosc - brew install hdf5 - - pip3 install --upgrade pip - pip3 install cython - pip3 install numpy==2.1 - pip3 install --upgrade scipy numba astropy - pip3 install matplotlib==3.8.4 - pip3 install . - - brew install sphinx-doc pandoc - - pip3 install wheel - pip3 install mock recommonmark - pip3 install sphinx_rtd_theme - pip3 install -U sphinx nbsphinx sphinx-gallery - - - - sphinx-apidoc -f -o docs/api/ gammapy_plugin - - - uses: actions/upload-artifact@v6 - with: - name: api-stubs-for-${{ github.sha }} - path: docs/api - - build_docs: - name: "Build the Documentation" - runs-on: macos-latest - needs: [notebooks, api_doc] - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - - - name: Set up Python - uses: actions/setup-python@v6 - with: - python-version: 3.11 - - - name: Install package - run: | - - brew install c-blosc - brew install hdf5 - pip3 install numpy scipy numba astropy matplotlib==3.8.4 - brew install sphinx-doc pandoc - - pip3 install wheel - pip3 install mock recommonmark - pip3 install sphinx_rtd_theme - pip3 install -U sphinx nbsphinx sphinx-gallery - pip3 install threeML - pip3 install --upgrade git+https://github.com/threeml/astromodels.git - pip3 install --upgrade git+https://github.com/threeml/threeML.git - pip3 install --upgrade gammapy --use-pep517 - - - pip3 install -e . - - rm -rf docs/md/* - env: - ISDEV: ${{contains(github.rev,'dev') || contains(github.base_ref, 'dev')}} - - - uses: actions/download-artifact@master - with: - name: notebooks-for-${{ github.sha }} - path: docs/notebooks - - - uses: actions/download-artifact@master - with: - name: api-stubs-for-${{ github.sha }} - path: docs/notebooks/api - - - name: Build and Commit - uses: sphinx-notes/pages@master - with: - documentation_path: docs - sphinx_version: 5.1.1 - requirements_path: docs/requirements.txt - - - name: Push changes - if: github.event_name == 'push' - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages From c4caa30c45b8768553deff2704c1d7530c0b5970 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Thu, 28 May 2026 13:36:43 +0200 Subject: [PATCH 07/18] add: public update method --- gammapy_plugin/converter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gammapy_plugin/converter.py b/gammapy_plugin/converter.py index 2a6129a..ad42337 100644 --- a/gammapy_plugin/converter.py +++ b/gammapy_plugin/converter.py @@ -221,6 +221,13 @@ def _create_skymodel(self) -> None: ) self._gather_mappings() + def update(self) -> None: + """ + This invokes the updating of all parameters of the converted model in the + gammapy SkyModels + """ + self._update_parameters() + @property def skymodel(self) -> SkyModel: """Returns the Gammapy skymodel for this source. From 002e3a3445baf07765028ed7ccd057bd553dc9ed Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 13:44:34 +0200 Subject: [PATCH 08/18] add: public update method for converter --- gammapy_plugin/converter.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gammapy_plugin/converter.py b/gammapy_plugin/converter.py index ad42337..678c584 100644 --- a/gammapy_plugin/converter.py +++ b/gammapy_plugin/converter.py @@ -84,6 +84,11 @@ def _update_parameters(self) -> None: for name, source in self._converted_sources.items(): source._update_parameters() + def update(self) -> None: + """Update all parameters of all SkyModels witht the current values from the + astromodels model. Public method for _update_parameters""" + self._update_parameters() + @property def gammapy_models(self) -> list[SkyModel]: """ From b611c730a68b52cb10614a62aa0c6d6c00579e7d Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 14:13:37 +0200 Subject: [PATCH 09/18] ci: fix the sha also for PRs --- .github/workflows/docs.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 86caf53..04a40cc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,6 +22,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + - name: Set SHA + run: | + SHA="${{ github.event.pull_request.head.sha || github.sha }}" + echo "SHA=$SHA" >> "$GITHUB_ENV" - name: Set up Python uses: actions/setup-python@v6 with: @@ -40,9 +44,9 @@ jobs: jupytext --to ipynb --pipe black --execute docs/md_docs/*.md mkdir -p docs/notebooks mv docs/md_docs/*.ipynb docs/notebooks - echo "Next - uploading artifacts for sha ${{ github.sha }}" + echo "Next - uploading artifacts for sha ${SHA}" - uses: actions/upload-artifact@v6 with: - name: notebooks-for-${{ github.sha }} + name: notebooks-for-${SHA} path: docs/notebooks From 5ff1c32f1ef0b4384d7d2b8a2a995c181742be0f Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 14:22:50 +0200 Subject: [PATCH 10/18] ci: why cant it be just bash ... --- .github/workflows/docs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 04a40cc..e9f3647 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -45,8 +45,7 @@ jobs: mkdir -p docs/notebooks mv docs/md_docs/*.ipynb docs/notebooks echo "Next - uploading artifacts for sha ${SHA}" - - uses: actions/upload-artifact@v6 with: - name: notebooks-for-${SHA} + name: notebooks-for-${{ env.SHA }} path: docs/notebooks From e05d3d1597ca7f6d1635d5fe6296cc94cda9f5b7 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 14:48:03 +0200 Subject: [PATCH 11/18] docs: try downloading notebooks --- .github/workflows/docs.yml | 9 ++++++++ .readthedocs.yaml | 2 ++ docs/download_notebooks.sh | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 docs/download_notebooks.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e9f3647..265680e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -49,3 +49,12 @@ jobs: with: name: notebooks-for-${{ env.SHA }} path: docs/notebooks + - name: Trigger RTD + shell: bash -l {0} + run: | + curl \ + --data "branches=${{ ${{ github.head_ref || github.ref_name }} }}&token=${{ env.TOKEN }}&default_branch=main" \ + https://app.readthedocs.org/api/v2/webhook/gammapy-plugin/327402/ + + with: + TOKEN: ${{ secrets.RTD_API }} diff --git a/.readthedocs.yaml b/.readthedocs.yaml index c613caa..8e4ca36 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,6 +10,8 @@ build: jobs: pre_build: - sphinx-apidoc . -o docs/api + - bash docs/download_notebooks.sh + # Build documentation in the "docs/" directory with Sphinx sphinx: diff --git a/docs/download_notebooks.sh b/docs/download_notebooks.sh new file mode 100644 index 0000000..ce50c64 --- /dev/null +++ b/docs/download_notebooks.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +set -euo pipefail + +OWNER="threeML" +REPO="gammapy-plugin" +SHA="${READTHEDOCS_GIT_COMMIT_HASH}" +TOKEN="${GITHUB_TOKEN}" + +API="https://api.github.com/repos/$OWNER/$REPO" + +# Find artifact ID whose name contains the SHA +# + +ARTIFACT_ID=$( + curl -fsSL \ + -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "$API/actions/artifacts?per_page=100" \ + | jq -r --arg SHA "$SHA" ' + .artifacts[] + | select(.expired == false) + | select(.name | contains($SHA)) + | .id + ' \ + | head -n1 +) + +if [[ -z "$ARTIFACT_ID" ]]; then + echo "No artifact found for SHA: $SHA" + exit 1 +fi + +echo "Artifact ID: $ARTIFACT_ID" + +# Download artifact ZIP +curl -fL \ + -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "$API/actions/artifacts/$ARTIFACT_ID/zip" \ + -o artifact.zip + +echo "Downloaded artifact.zip" +mkdir -p docs/notebooks +unzip artifact.zip -d docs/notebooks +rm artifac.zip +echo "Done unzipping" From 46c7e658f56c7f1fab882b8ae99dec0a262eed7e Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 14:49:53 +0200 Subject: [PATCH 12/18] ci: syntax fix getting branch name --- .github/workflows/docs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 265680e..cc087be 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -53,8 +53,8 @@ jobs: shell: bash -l {0} run: | curl \ - --data "branches=${{ ${{ github.head_ref || github.ref_name }} }}&token=${{ env.TOKEN }}&default_branch=main" \ + --data "branches=${{ github.head_ref || github.ref_name }}&token=${{ env.TOKEN }}&default_branch=main" \ https://app.readthedocs.org/api/v2/webhook/gammapy-plugin/327402/ - with: + env: TOKEN: ${{ secrets.RTD_API }} From 1aec26bd30000e72b3ccce78f8433ab4062a3998 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:01:17 +0200 Subject: [PATCH 13/18] ci: try again --- .github/workflows/docs.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cc087be..a336102 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -52,9 +52,12 @@ jobs: - name: Trigger RTD shell: bash -l {0} run: | - curl \ - --data "branches=${{ github.head_ref || github.ref_name }}&token=${{ env.TOKEN }}&default_branch=main" \ - https://app.readthedocs.org/api/v2/webhook/gammapy-plugin/327402/ + curl -X POST \ + "https://app.readthedocs.org/api/v2/webhook/gammapy-plugin/327402/" \ + --data-urlencode "branches=${BRANCH}" \ + --data-urlencode "token=${TOKEN}" \ + --data-urlencode "default_branch=main" env: - TOKEN: ${{ secrets.RTD_API }} + TOKEN: ${{ secrets.RTD_API }} + BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} From 2267c8d93f995567ff927af9f1b8c296afc7cf5a Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:06:06 +0200 Subject: [PATCH 14/18] ci: use v3 api instead --- .github/workflows/docs.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a336102..3d6acb8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -49,14 +49,17 @@ jobs: with: name: notebooks-for-${{ env.SHA }} path: docs/notebooks - - name: Trigger RTD + + - name: Trigger RTD shell: bash -l {0} run: | curl -X POST \ - "https://app.readthedocs.org/api/v2/webhook/gammapy-plugin/327402/" \ - --data-urlencode "branches=${BRANCH}" \ - --data-urlencode "token=${TOKEN}" \ - --data-urlencode "default_branch=main" + "https://app.readthedocs.org/api/v3/projects/gammapy-plugin/versions/latest/builds/" \ + -H "Authorization: Token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "{ + \"branch\": \"${BRANCH}\" + }" env: TOKEN: ${{ secrets.RTD_API }} From d9f035e85c0e0abc2657ea74ef2bea2c091d3f67 Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:16:30 +0200 Subject: [PATCH 15/18] docs: use ultranest for notebook building --- .github/workflows/docs.yml | 1 + docs/md_docs/crab_spectrum.md | 4 ++-- docs/requirements.txt | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3d6acb8..0768d48 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,6 +32,7 @@ jobs: python-version: 3.13 - name: Install dependencies run: | + pip install black ultranest pip install -e . pip install -r docs/requirements.txt diff --git a/docs/md_docs/crab_spectrum.md b/docs/md_docs/crab_spectrum.md index 7aab875..1cdf4cb 100644 --- a/docs/md_docs/crab_spectrum.md +++ b/docs/md_docs/crab_spectrum.md @@ -148,8 +148,8 @@ gl.set_datasets(datasets) gl.set_model(model, converted_model=conv) ba = BayesianAnalysis(model, DataList(gl)) -ba.set_sampler("multinest") -ba.sampler.setup(resume = False) +ba.set_sampler("ultranest") +ba.sampler.setup() ba.sample() res = ba.results res diff --git a/docs/requirements.txt b/docs/requirements.txt index d21a0e8..b5907a8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -8,4 +8,3 @@ sphinx-copybutton sphinxcontrib-email jupytext furo -black From aaeac6cfc792fae57af3d33d50ff30c08b4127ec Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:16:41 +0200 Subject: [PATCH 16/18] ci: fix versioning triggering --- .github/workflows/docs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0768d48..74a2407 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -55,7 +55,7 @@ jobs: shell: bash -l {0} run: | curl -X POST \ - "https://app.readthedocs.org/api/v3/projects/gammapy-plugin/versions/latest/builds/" \ + "https://app.readthedocs.org/api/v3/projects/gammapy-plugin/versions/${PR_NUMBER}/builds/" \ -H "Authorization: Token $TOKEN" \ -H "Content-Type: application/json" \ -d "{ @@ -65,3 +65,4 @@ jobs: env: TOKEN: ${{ secrets.RTD_API }} BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} + PR_NUMBER: ${{ github.event.number || "latest" }} From 25aa9f807f676a880513a357ffb9e4cb3478464f Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:23:14 +0200 Subject: [PATCH 17/18] ci: syntax fix --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 74a2407..32d1afc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -65,4 +65,4 @@ jobs: env: TOKEN: ${{ secrets.RTD_API }} BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} - PR_NUMBER: ${{ github.event.number || "latest" }} + PR_NUMBER: ${{ github.event.number || 'latest' }} From 38093c2d85827deabef20e37d80f2264aa14ff2d Mon Sep 17 00:00:00 2001 From: Tobias Preis Date: Fri, 29 May 2026 15:23:31 +0200 Subject: [PATCH 18/18] docs: rtd download switch to python instead of jq for parsing --- docs/download_notebooks.sh | 49 +++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/docs/download_notebooks.sh b/docs/download_notebooks.sh index ce50c64..e024a84 100644 --- a/docs/download_notebooks.sh +++ b/docs/download_notebooks.sh @@ -8,21 +8,34 @@ TOKEN="${GITHUB_TOKEN}" API="https://api.github.com/repos/$OWNER/$REPO" -# Find artifact ID whose name contains the SHA -# +echo "Searching artifacts for SHA: $SHA" ARTIFACT_ID=$( - curl -fsSL \ - -H "Authorization: Bearer $TOKEN" \ - -H "Accept: application/vnd.github+json" \ - "$API/actions/artifacts?per_page=100" \ - | jq -r --arg SHA "$SHA" ' - .artifacts[] - | select(.expired == false) - | select(.name | contains($SHA)) - | .id - ' \ - | head -n1 +python3 - <