From 256de9ad2c582990deb4687791f8f1fc94b8c45f Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Thu, 21 Nov 2024 05:55:18 -0800 Subject: [PATCH 01/59] rename title to match slug --- docs/overview/application-criteria.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/overview/application-criteria.md b/docs/overview/application-criteria.md index 5e317655..6e49aeaa 100644 --- a/docs/overview/application-criteria.md +++ b/docs/overview/application-criteria.md @@ -1,5 +1,5 @@ --- -title: Application Criteria & Current Capabilities +title: Application Criteria description: What can you use Monty for? --- # Requirements From f55b0fce139229d2ccd1e2c0f210585eed16e04a Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 19:53:54 -0800 Subject: [PATCH 02/59] action --- .github/workflows/docs.yml | 62 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aeed8067..67c4a955 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,6 +13,7 @@ on: - main jobs: + check_docs: name: check-docs runs-on: ubuntu-latest @@ -66,6 +67,67 @@ jobs: source activate tbp.monty python -m tools.github_readme_sync.cli check docs + deploy_pr_docs: + name: deploy-pr-docs + runs-on: ubuntu-latest + needs: + - should_run_docs + if: github.event_name == 'pull_request' + steps: + - name: Checkout tbp.monty + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Set up ~/tbp + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + mkdir -p ~/tbp + ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty + - name: Set up Python 3.8 + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install miniconda + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + if [ ! -d ~/miniconda ] + then + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh + bash ~/miniconda.sh -b -p ~/miniconda + rm ~/miniconda.sh + fi + export PATH="$HOME/miniconda/bin:$PATH" + conda --version + - name: Create conda environment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true + conda env create + source activate tbp.monty + pip install -e .[dev,github_readme_sync_tool] + - name: Get version and branch + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + echo "VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV + # Make branch name safe for semver by replacing invalid chars with dash + echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-')" >> $GITHUB_ENV + - name: Deploy docs + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" + should_run_docs: name: should-run-docs runs-on: ubuntu-latest From 9f6db9429e503e5dc6015a4bce94f9f16b4dd3f1 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 19:54:50 -0800 Subject: [PATCH 03/59] action --- .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 67c4a955..2688e630 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,7 @@ on: - main jobs: - + check_docs: name: check-docs runs-on: ubuntu-latest @@ -131,7 +131,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO add back in later outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From 500a31808f37870d1c9ad0112360f6aa419b2859 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 19:57:44 -0800 Subject: [PATCH 04/59] action --- .github/workflows/docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2688e630..bf2cced1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -67,8 +67,8 @@ jobs: source activate tbp.monty python -m tools.github_readme_sync.cli check docs - deploy_pr_docs: - name: deploy-pr-docs + deploy_preview_docs: + name: deploy-preview-docs runs-on: ubuntu-latest needs: - should_run_docs @@ -110,7 +110,7 @@ jobs: (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true conda env create source activate tbp.monty - pip install -e .[dev,github_readme_sync_tool] + pip install -e .[dev,github_readme_sync_tool,print_version_tool] - name: Get version and branch if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty From f7f90fbc458278419188f4a9f1bf2f393dd093d4 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 20:14:57 -0800 Subject: [PATCH 05/59] action --- .github/workflows/docs.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bf2cced1..3efafa35 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -74,6 +74,16 @@ jobs: - should_run_docs if: github.event_name == 'pull_request' steps: + - name: Create initial PR comment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + Building documentation preview... ⏳ + + Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: actions/checkout@v4 @@ -127,6 +137,27 @@ jobs: export PATH="$HOME/miniconda/bin:$PATH" source activate tbp.monty python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" + - name: Update PR comment on success + if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + ✅ A preview of the documentation changes in this PR is available at: + ${{ env.DOCS_URL_PREFIX }}${{ env.VERSION }}-${{ env.BRANCH_NAME }} + + Last updated: $(date '+%B %d, %Y at %H:%M:%S UTC') + - name: Update PR comment on failure + if: ${{ failure() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + ❌ Failed to build documentation preview. + + Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. should_run_docs: name: should-run-docs From 3658610d194ed29e015cdc6b7b924fbdcd1fefe5 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 20:20:22 -0800 Subject: [PATCH 06/59] action --- .github/workflows/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3efafa35..e58bdc5d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -136,6 +136,9 @@ jobs: run: | export PATH="$HOME/miniconda/bin:$PATH" source activate tbp.monty + env: + README_API_KEY: ${{ secrets.README_API_KEY }} + IMAGE_PATH: ${{ vars.IMAGE_PATH }} python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - name: Update PR comment on success if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} From 8c7ede2927cbe4f4309a157ad98a236194c4c20e Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 20:25:43 -0800 Subject: [PATCH 07/59] action --- .github/workflows/docs.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e58bdc5d..a7be4418 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -80,7 +80,7 @@ jobs: with: message: | 📚 **Documentation Preview** - + Building documentation preview... ⏳ Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. @@ -136,9 +136,8 @@ jobs: run: | export PATH="$HOME/miniconda/bin:$PATH" source activate tbp.monty - env: - README_API_KEY: ${{ secrets.README_API_KEY }} - IMAGE_PATH: ${{ vars.IMAGE_PATH }} + export README_API_KEY=${{ secrets.README_API_KEY }} + export IMAGE_PATH=${{ vars.IMAGE_PATH }} python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - name: Update PR comment on success if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} From b53a36ec593878a67602b85d4efacdbbb8674474 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 20:46:39 -0800 Subject: [PATCH 08/59] action --- .github/workflows/docs.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a7be4418..b0446d02 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -129,7 +129,10 @@ jobs: source activate tbp.monty echo "VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV # Make branch name safe for semver by replacing invalid chars with dash - echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-')" >> $GITHUB_ENV + # Remove trailing dash if present + echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-' | sed 's/-*$//')" >> $GITHUB_ENV + # Get current date in ISO format + echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV - name: Deploy docs if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty @@ -145,11 +148,11 @@ jobs: with: message: | 📚 **Documentation Preview** - + ✅ A preview of the documentation changes in this PR is available at: - ${{ env.DOCS_URL_PREFIX }}${{ env.VERSION }}-${{ env.BRANCH_NAME }} - - Last updated: $(date '+%B %d, %Y at %H:%M:%S UTC') + ${{ vars.DOCS_URL_PREFIX }}${{ env.VERSION }}-${{ env.BRANCH_NAME }} + + Last updated: ${{ env.DATE }} - name: Update PR comment on failure if: ${{ failure() && needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: marocchino/sticky-pull-request-comment@v2 @@ -158,7 +161,7 @@ jobs: 📚 **Documentation Preview** ❌ Failed to build documentation preview. - + Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. should_run_docs: From b2a05e936e5363aa155ae518ba57031b35e94d45 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sat, 23 Nov 2024 21:04:53 -0800 Subject: [PATCH 09/59] action --- .github/workflows/docs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b0446d02..91545f41 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -149,8 +149,8 @@ jobs: message: | 📚 **Documentation Preview** - ✅ A preview of the documentation changes in this PR is available at: - ${{ vars.DOCS_URL_PREFIX }}${{ env.VERSION }}-${{ env.BRANCH_NAME }} + ✅ A preview of the documentation changes in this PR is available for maintainers at: + ${{ vars.DOCS_URL_PREFIX }}v${{ env.VERSION }}-${{ env.BRANCH_NAME }} Last updated: ${{ env.DATE }} - name: Update PR comment on failure @@ -167,7 +167,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO add back in later + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From dd94c47c517f6e07325139bae5de9a0d515a1d7b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 06:24:57 -0800 Subject: [PATCH 10/59] remove blank line --- .github/workflows/docs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 91545f41..4daf740f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -13,7 +13,6 @@ on: - main jobs: - check_docs: name: check-docs runs-on: ubuntu-latest From bff7b03b4afe35c98df23062bf63f1d1f406abb0 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 06:30:57 -0800 Subject: [PATCH 11/59] action --- .../welcome-to-the-thousand-brains-project-documentation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md index 0b2c0995..ea6d3aec 100644 --- a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md +++ b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md @@ -34,6 +34,7 @@ The documentation is broken into six main sections: We are excited to have you here! Our intention for making the project open-source is to foster a community of researchers and developers interested in contributing to the project and to allow all of humanity to benefit from these advances in AI. The Thousand Brains Project team is quite small, and we have a limited amount of time, so please be patient with our responses and know that we'll do our best to get back to you as soon as possible. That said, here's a list of [ways you can contribute to the project](../contributing/ways-to-contribute-to-code.md). +# temp section remove me before merging ----------------------------------- From b87c637e950edd6cf9bab9bc68265ea7a754b55a Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 06:36:41 -0800 Subject: [PATCH 12/59] action --- .../welcome-to-the-thousand-brains-project-documentation.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md index ea6d3aec..e3f319c9 100644 --- a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md +++ b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md @@ -34,8 +34,6 @@ The documentation is broken into six main sections: We are excited to have you here! Our intention for making the project open-source is to foster a community of researchers and developers interested in contributing to the project and to allow all of humanity to benefit from these advances in AI. The Thousand Brains Project team is quite small, and we have a limited amount of time, so please be patient with our responses and know that we'll do our best to get back to you as soon as possible. That said, here's a list of [ways you can contribute to the project](../contributing/ways-to-contribute-to-code.md). -# temp section remove me before merging - ----------------------------------- # Resources From a2da61544729ac00bb0e6b20433d78dc769dcf5c Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 06:37:08 -0800 Subject: [PATCH 13/59] action --- .../welcome-to-the-thousand-brains-project-documentation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md index e3f319c9..0b2c0995 100644 --- a/docs/overview/welcome-to-the-thousand-brains-project-documentation.md +++ b/docs/overview/welcome-to-the-thousand-brains-project-documentation.md @@ -34,6 +34,7 @@ The documentation is broken into six main sections: We are excited to have you here! Our intention for making the project open-source is to foster a community of researchers and developers interested in contributing to the project and to allow all of humanity to benefit from these advances in AI. The Thousand Brains Project team is quite small, and we have a limited amount of time, so please be patient with our responses and know that we'll do our best to get back to you as soon as possible. That said, here's a list of [ways you can contribute to the project](../contributing/ways-to-contribute-to-code.md). + ----------------------------------- # Resources From f4e256680c65d804e13227a92d7e1a74d6033f41 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 07:19:03 -0800 Subject: [PATCH 14/59] check to run on PR preview to run on PRT --- .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 4daf740f..eba8e18d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,6 +11,9 @@ on: pull_request: branches: - main + pull_request_target: + branches: + - main jobs: check_docs: @@ -18,6 +21,7 @@ jobs: runs-on: ubuntu-latest needs: - should_run_docs + if: github.event_name == 'pull_request' steps: - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} @@ -71,7 +75,7 @@ jobs: runs-on: ubuntu-latest needs: - should_run_docs - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request_target' steps: - name: Create initial PR comment if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} @@ -177,7 +181,7 @@ jobs: lfs: true path: tbp.monty - name: Filter by path for a pull request - if: ${{ github.event_name == 'pull_request' }} + if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} id: filter_by_path_pr working-directory: tbp.monty run: | From ce25a41309d2d1c9cc613be7a4a6acfc11853f8b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 07:20:10 -0800 Subject: [PATCH 15/59] action --- .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 eba8e18d..50d91906 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -170,7 +170,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO put this before merge outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From a40f252f30e6bc19cd61676496592fd045c1c8bd Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:30:38 -0800 Subject: [PATCH 16/59] action --- .github/workflows/docs-check.yml | 116 ++++++++++++++++++ .../workflows/{docs.yml => docs-preview.yml} | 78 +----------- 2 files changed, 117 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/docs-check.yml rename .github/workflows/{docs.yml => docs-preview.yml} (66%) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml new file mode 100644 index 00000000..b48941c5 --- /dev/null +++ b/.github/workflows/docs-check.yml @@ -0,0 +1,116 @@ +name: Docs + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + check_docs: + name: check-docs + runs-on: ubuntu-latest + needs: + - should_run_docs + if: github.event_name == 'pull_request' + steps: + - name: Checkout tbp.monty + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Set up ~/tbp + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + mkdir -p ~/tbp + ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty + - name: Set up Python 3.8 + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install miniconda + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + if [ ! -d ~/miniconda ] + then + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh + bash ~/miniconda.sh -b -p ~/miniconda + rm ~/miniconda.sh + fi + export PATH="$HOME/miniconda/bin:$PATH" + conda --version + - name: Create conda environment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true + conda env create + source activate tbp.monty + pip install -e .[dev,github_readme_sync_tool] + pip list + conda list + - name: Check docs + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + python -m tools.github_readme_sync.cli check docs + + should_run_docs: + name: should-run-docs + runs-on: ubuntu-latest + # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO put this before merge + outputs: + should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} + steps: + - name: Checkout tbp.monty + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Filter by path for a pull request + if: ${{ github.event_name == 'pull_request' }} + id: filter_by_path_pr + working-directory: tbp.monty + run: | + git diff --name-only origin/${{ github.base_ref }} > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]] || + [[ $changed_file == tools/github_readme_sync/* ]] || + [[ $changed_file == .github/workflows/docs.yml ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Filter by path for a push + if: ${{ github.event_name == 'push' }} + id: filter_by_path_push + working-directory: tbp.monty + run: | + git diff --name-only HEAD^1 > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Should run + id: should_run + if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} + run: echo "should_run_docs=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs-preview.yml similarity index 66% rename from .github/workflows/docs.yml rename to .github/workflows/docs-preview.yml index 50d91906..b748dcc4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs-preview.yml @@ -5,77 +5,16 @@ concurrency: cancel-in-progress: true on: - push: - branches: - - main pull_request: branches: - main - pull_request_target: - branches: - - main jobs: - check_docs: - name: check-docs - runs-on: ubuntu-latest - needs: - - should_run_docs - if: github.event_name == 'pull_request' - steps: - - name: Checkout tbp.monty - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Set up ~/tbp - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - mkdir -p ~/tbp - ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty - - name: Set up Python 3.8 - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Install miniconda - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - if [ ! -d ~/miniconda ] - then - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh - bash ~/miniconda.sh -b -p ~/miniconda - rm ~/miniconda.sh - fi - export PATH="$HOME/miniconda/bin:$PATH" - conda --version - - name: Create conda environment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true - conda env create - source activate tbp.monty - pip install -e .[dev,github_readme_sync_tool] - pip list - conda list - - name: Check docs - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - source activate tbp.monty - python -m tools.github_readme_sync.cli check docs - deploy_preview_docs: name: deploy-preview-docs runs-on: ubuntu-latest needs: - should_run_docs - if: github.event_name == 'pull_request_target' steps: - name: Create initial PR comment if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} @@ -181,7 +120,6 @@ jobs: lfs: true path: tbp.monty - name: Filter by path for a pull request - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} id: filter_by_path_pr working-directory: tbp.monty run: | @@ -196,21 +134,7 @@ jobs: exit 0 fi done < changed_files.txt - - name: Filter by path for a push - if: ${{ github.event_name == 'push' }} - id: filter_by_path_push - working-directory: tbp.monty - run: | - git diff --name-only HEAD^1 > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - name: Should run id: should_run - if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} + if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' }} run: echo "should_run_docs=true" >> $GITHUB_OUTPUT From f4b5ed7b217b59aac7ddbd46b821733983a968cc Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:34:31 -0800 Subject: [PATCH 17/59] action --- .github/workflows/docs-preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index b748dcc4..d99d3300 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -106,6 +106,7 @@ jobs: Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. + should_run_docs: name: should-run-docs runs-on: ubuntu-latest From 5830a84aea78f8a5ec3bbab30eca131ac073b1dd Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:35:23 -0800 Subject: [PATCH 18/59] action --- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs-preview.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index b48941c5..b74adb2e 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,4 +1,4 @@ -name: Docs +name: Docs Checks concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index d99d3300..96da1ab6 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -1,4 +1,4 @@ -name: Docs +name: Docs Preview concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} @@ -106,7 +106,6 @@ jobs: Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. - should_run_docs: name: should-run-docs runs-on: ubuntu-latest From 193fc80b7932919e35d22185ba1a093de8f3fd0d Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:36:39 -0800 Subject: [PATCH 19/59] action --- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs-preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index b74adb2e..8fa5150d 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -91,7 +91,7 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs.yml ]]; then + [[ $changed_file == .github/workflows/docs* ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 96da1ab6..517d3e22 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -129,7 +129,7 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs.yml ]]; then + [[ $changed_file == .github/workflows/docs* ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi From 9d479044ac017f4d0c17ad702675a037a3a5c64c Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:44:04 -0800 Subject: [PATCH 20/59] action --- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs-preview.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 8fa5150d..ac5fcf38 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -70,7 +70,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO put this before merge + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 517d3e22..69187d24 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -5,7 +5,7 @@ concurrency: cancel-in-progress: true on: - pull_request: + pull_request_target: branches: - main @@ -109,7 +109,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - # if: ${{ github.repository_owner == 'thousandbrainsproject' }} TODO put this before merge + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From 249831d0aaeb55cbd2575dcd8b7091178b9489be Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 10:45:25 -0800 Subject: [PATCH 21/59] action --- .github/workflows/docs-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index ac5fcf38..7c3169ea 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,4 +1,4 @@ -name: Docs Checks +name: Docs Check concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} From 6962eaffe317be7707c3e096bed88d516de08fba Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Sun, 24 Nov 2024 12:29:05 -0800 Subject: [PATCH 22/59] trailing space --- .github/workflows/docs-check.yml | 2 +- .github/workflows/docs-preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 7c3169ea..becfde5a 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -70,7 +70,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 69187d24..69803a07 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -109,7 +109,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From b33f84e22e3391577a5b3a029b0f1b0f7886096d Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:12:31 -0800 Subject: [PATCH 23/59] revert --- .github/workflows/docs-preview.yml | 140 ------------------ .../workflows/{docs-check.yml => docs.yml} | 5 +- 2 files changed, 2 insertions(+), 143 deletions(-) delete mode 100644 .github/workflows/docs-preview.yml rename .github/workflows/{docs-check.yml => docs.yml} (96%) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml deleted file mode 100644 index 69803a07..00000000 --- a/.github/workflows/docs-preview.yml +++ /dev/null @@ -1,140 +0,0 @@ -name: Docs Preview - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true - -on: - pull_request_target: - branches: - - main - -jobs: - deploy_preview_docs: - name: deploy-preview-docs - runs-on: ubuntu-latest - needs: - - should_run_docs - steps: - - name: Create initial PR comment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: marocchino/sticky-pull-request-comment@v2 - with: - message: | - 📚 **Documentation Preview** - - Building documentation preview... ⏳ - - Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. - - name: Checkout tbp.monty - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Set up ~/tbp - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - mkdir -p ~/tbp - ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty - - name: Set up Python 3.8 - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Install miniconda - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - if [ ! -d ~/miniconda ] - then - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh - bash ~/miniconda.sh -b -p ~/miniconda - rm ~/miniconda.sh - fi - export PATH="$HOME/miniconda/bin:$PATH" - conda --version - - name: Create conda environment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true - conda env create - source activate tbp.monty - pip install -e .[dev,github_readme_sync_tool,print_version_tool] - - name: Get version and branch - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - source activate tbp.monty - echo "VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV - # Make branch name safe for semver by replacing invalid chars with dash - # Remove trailing dash if present - echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-' | sed 's/-*$//')" >> $GITHUB_ENV - # Get current date in ISO format - echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV - - name: Deploy docs - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - source activate tbp.monty - export README_API_KEY=${{ secrets.README_API_KEY }} - export IMAGE_PATH=${{ vars.IMAGE_PATH }} - python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - - name: Update PR comment on success - if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: marocchino/sticky-pull-request-comment@v2 - with: - message: | - 📚 **Documentation Preview** - - ✅ A preview of the documentation changes in this PR is available for maintainers at: - ${{ vars.DOCS_URL_PREFIX }}v${{ env.VERSION }}-${{ env.BRANCH_NAME }} - - Last updated: ${{ env.DATE }} - - name: Update PR comment on failure - if: ${{ failure() && needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: marocchino/sticky-pull-request-comment@v2 - with: - message: | - 📚 **Documentation Preview** - - ❌ Failed to build documentation preview. - - Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. - - should_run_docs: - name: should-run-docs - runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} - outputs: - should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} - steps: - - name: Checkout tbp.monty - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Filter by path for a pull request - id: filter_by_path_pr - working-directory: tbp.monty - run: | - git diff --name-only origin/${{ github.base_ref }} > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]] || - [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs* ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - - name: Should run - id: should_run - if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' }} - run: echo "should_run_docs=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs.yml similarity index 96% rename from .github/workflows/docs-check.yml rename to .github/workflows/docs.yml index 8515cd4e..7b0684da 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Docs Check +name: Docs concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} @@ -18,7 +18,6 @@ jobs: runs-on: ubuntu-latest needs: - should_run_docs - if: github.event_name == 'pull_request' steps: - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} @@ -91,7 +90,7 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs* ]]; then + [[ $changed_file == .github/workflows/docs.yml ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi From 7f2d23294f090a9a37813fad70bdb64eb6b9bc98 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:13:24 -0800 Subject: [PATCH 24/59] action --- .github/workflows/docs-check.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/docs-check.yml diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml new file mode 100644 index 00000000..3a9f680e --- /dev/null +++ b/.github/workflows/docs-check.yml @@ -0,0 +1,14 @@ +name: Docs Check + +on: + pull_request: + branches: + - main + +jobs: + docs-check: + name: docs-check + runs-on: ubuntu-latest + steps: + - name: Echo Hello + run: echo "Hello" From cbb4bb187f430a363be35e7008c5bcf73838b0bb Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:16:36 -0800 Subject: [PATCH 25/59] action --- .github/workflows/docs-check.yml | 109 +++++++++++++++++++++++++++++-- .github/workflows/docs.yml | 3 +- 2 files changed, 107 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 3a9f680e..dc8a28e0 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,14 +1,115 @@ name: Docs Check +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + on: + push: + branches: + - main pull_request: branches: - main jobs: - docs-check: - name: docs-check + check_docs: + name: check-docs + runs-on: ubuntu-latest + needs: + - should_run_docs + steps: + - name: Checkout tbp.monty + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Set up ~/tbp + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + mkdir -p ~/tbp + ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty + - name: Set up Python 3.8 + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install miniconda + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + if [ ! -d ~/miniconda ] + then + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh + bash ~/miniconda.sh -b -p ~/miniconda + rm ~/miniconda.sh + fi + export PATH="$HOME/miniconda/bin:$PATH" + conda --version + - name: Create conda environment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true + conda env create + source activate tbp.monty + pip install -e .[dev,github_readme_sync_tool] + pip list + conda list + - name: Check docs + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + python -m tools.github_readme_sync.cli check docs + + should_run_docs: + name: should-run-docs runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'thousandbrainsproject' }} + outputs: + should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: - - name: Echo Hello - run: echo "Hello" + - name: Checkout tbp.monty + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Filter by path for a pull request + if: ${{ github.event_name == 'pull_request' }} + id: filter_by_path_pr + working-directory: tbp.monty + run: | + git diff --name-only origin/${{ github.base_ref }} > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]] || + [[ $changed_file == tools/github_readme_sync/* ]] || + [[ $changed_file == .github/workflows/docs* ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Filter by path for a push + if: ${{ github.event_name == 'push' }} + id: filter_by_path_push + working-directory: tbp.monty + run: | + git diff --name-only ${{ github.sha }}^1 > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Should run + id: should_run + if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} + run: echo "should_run_docs=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7b0684da..f9f9ca6a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -90,7 +90,8 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs.yml ]]; then + [[ $changed_file == .github/workflows/docs-check.yml ]] || + [[ $changed_file == .github/workflows/docs-preview.yml ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi From d05164597c9df1dca9df8287a127c1a5ff008cd9 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:17:38 -0800 Subject: [PATCH 26/59] action --- .github/workflows/docs-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index dc8a28e0..e5d31f1a 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,4 +1,4 @@ -name: Docs Check +name: Docs2 concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} From cf5d53096bfde654275daf6d20eca6158aef99db Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:18:18 -0800 Subject: [PATCH 27/59] action --- .github/workflows/docs-check.yml | 111 ++----------------------------- 1 file changed, 5 insertions(+), 106 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index e5d31f1a..3a9f680e 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,115 +1,14 @@ -name: Docs2 - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} - cancel-in-progress: true +name: Docs Check on: - push: - branches: - - main pull_request: branches: - main jobs: - check_docs: - name: check-docs - runs-on: ubuntu-latest - needs: - - should_run_docs - steps: - - name: Checkout tbp.monty - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Set up ~/tbp - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - mkdir -p ~/tbp - ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty - - name: Set up Python 3.8 - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Install miniconda - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - run: | - if [ ! -d ~/miniconda ] - then - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh - bash ~/miniconda.sh -b -p ~/miniconda - rm ~/miniconda.sh - fi - export PATH="$HOME/miniconda/bin:$PATH" - conda --version - - name: Create conda environment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true - conda env create - source activate tbp.monty - pip install -e .[dev,github_readme_sync_tool] - pip list - conda list - - name: Check docs - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} - working-directory: tbp.monty - run: | - export PATH="$HOME/miniconda/bin:$PATH" - source activate tbp.monty - python -m tools.github_readme_sync.cli check docs - - should_run_docs: - name: should-run-docs + docs-check: + name: docs-check runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} - outputs: - should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: - - name: Checkout tbp.monty - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Filter by path for a pull request - if: ${{ github.event_name == 'pull_request' }} - id: filter_by_path_pr - working-directory: tbp.monty - run: | - git diff --name-only origin/${{ github.base_ref }} > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]] || - [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs* ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - - name: Filter by path for a push - if: ${{ github.event_name == 'push' }} - id: filter_by_path_push - working-directory: tbp.monty - run: | - git diff --name-only ${{ github.sha }}^1 > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - - name: Should run - id: should_run - if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} - run: echo "should_run_docs=true" >> $GITHUB_OUTPUT + - name: Echo Hello + run: echo "Hello" From 75174489fc8ac1a367b959601adfc9c17e1a6942 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:19:32 -0800 Subject: [PATCH 28/59] action --- .github/workflows/docs-check.yml | 108 +++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 3a9f680e..d11d8d32 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,14 +1,112 @@ -name: Docs Check +name: Docs2 + on: + push: + branches: + - main pull_request: branches: - main jobs: - docs-check: - name: docs-check + check_docs: + name: check-docs + runs-on: ubuntu-latest + needs: + - should_run_docs + steps: + - name: Checkout tbp.monty + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Set up ~/tbp + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + mkdir -p ~/tbp + ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty + - name: Set up Python 3.8 + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install miniconda + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + run: | + if [ ! -d ~/miniconda ] + then + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh + bash ~/miniconda.sh -b -p ~/miniconda + rm ~/miniconda.sh + fi + export PATH="$HOME/miniconda/bin:$PATH" + conda --version + - name: Create conda environment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true + conda env create + source activate tbp.monty + pip install -e .[dev,github_readme_sync_tool] + pip list + conda list + - name: Check docs + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + python -m tools.github_readme_sync.cli check docs + + should_run_docs: + name: should-run-docs runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'thousandbrainsproject' }} + outputs: + should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: - - name: Echo Hello - run: echo "Hello" + - name: Checkout tbp.monty + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty + - name: Filter by path for a pull request + if: ${{ github.event_name == 'pull_request' }} + id: filter_by_path_pr + working-directory: tbp.monty + run: | + git diff --name-only origin/${{ github.base_ref }} > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]] || + [[ $changed_file == tools/github_readme_sync/* ]] || + [[ $changed_file == .github/workflows/docs* ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Filter by path for a push + if: ${{ github.event_name == 'push' }} + id: filter_by_path_push + working-directory: tbp.monty + run: | + git diff --name-only ${{ github.sha }}^1 > changed_files.txt + while IFS= read -r changed_file + do + echo $changed_file + if [[ $changed_file == docs/* ]]; then + echo "should_run_docs=true" >> $GITHUB_OUTPUT + exit 0 + fi + done < changed_files.txt + - name: Should run + id: should_run + if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} + run: echo "should_run_docs=true" >> $GITHUB_OUTPUT From bfb8dc1f6453cb7c10f27d7289ae9386830b3b3b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:21:50 -0800 Subject: [PATCH 29/59] action --- .github/workflows/docs-check.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index d11d8d32..5bd7ede4 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -1,5 +1,8 @@ -name: Docs2 +name: Docs Check +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true on: push: @@ -15,6 +18,7 @@ jobs: runs-on: ubuntu-latest needs: - should_run_docs + if: github.event_name == 'pull_request' steps: - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} @@ -66,7 +70,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + # if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: @@ -87,7 +91,8 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs* ]]; then + [[ $changed_file == .github/workflows/docs-check.yml ]] || + [[ $changed_file == .github/workflows/docs-preview.yml ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi From 1a2ad829d98a3b9e87fefa3d63d5b475d865fcdc Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:32:11 -0800 Subject: [PATCH 30/59] action --- .github/workflows/docs-check.yml | 1 - .../workflows/{docs.yml => docs-preview.yml} | 86 ++++++++++++------- 2 files changed, 55 insertions(+), 32 deletions(-) rename .github/workflows/{docs.yml => docs-preview.yml} (53%) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index 5bd7ede4..bbe275bc 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -18,7 +18,6 @@ jobs: runs-on: ubuntu-latest needs: - should_run_docs - if: github.event_name == 'pull_request' steps: - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs-preview.yml similarity index 53% rename from .github/workflows/docs.yml rename to .github/workflows/docs-preview.yml index f9f9ca6a..866604dd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs-preview.yml @@ -1,24 +1,31 @@ -name: Docs +name: Docs Preview concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} cancel-in-progress: true on: - push: - branches: - - main - pull_request: + pull_request_target: branches: - main jobs: - check_docs: - name: check-docs + deploy_preview_docs: + name: deploy-preview-docs runs-on: ubuntu-latest needs: - should_run_docs steps: + - name: Create initial PR comment + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + Building documentation preview... ⏳ + + Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. - name: Checkout tbp.monty if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: actions/checkout@v4 @@ -55,21 +62,54 @@ jobs: (conda env list | grep tbp.monty) && conda remove --name tbp.monty --all --yes || true conda env create source activate tbp.monty - pip install -e .[dev,github_readme_sync_tool] - pip list - conda list - - name: Check docs + pip install -e .[dev,github_readme_sync_tool,print_version_tool] + - name: Get version and branch if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty run: | export PATH="$HOME/miniconda/bin:$PATH" source activate tbp.monty - python -m tools.github_readme_sync.cli check docs + echo "VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV + # Make branch name safe for semver by replacing invalid chars with dash + # Remove trailing dash if present + echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-' | sed 's/-*$//')" >> $GITHUB_ENV + # Get current date in ISO format + echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV + - name: Deploy docs + if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} + working-directory: tbp.monty + run: | + export PATH="$HOME/miniconda/bin:$PATH" + source activate tbp.monty + export README_API_KEY=${{ secrets.README_API_KEY }} + export IMAGE_PATH=${{ vars.IMAGE_PATH }} + python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" + - name: Update PR comment on success + if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + ✅ A preview of the documentation changes in this PR is available for maintainers at: + ${{ vars.DOCS_URL_PREFIX }}v${{ env.VERSION }}-${{ env.BRANCH_NAME }} + + Last updated: ${{ env.DATE }} + - name: Update PR comment on failure + if: ${{ failure() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + 📚 **Documentation Preview** + + ❌ Failed to build documentation preview. + + Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. should_run_docs: name: should-run-docs runs-on: ubuntu-latest - if: ${{ github.repository_owner == 'thousandbrainsproject' }} + # if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: @@ -80,7 +120,6 @@ jobs: lfs: true path: tbp.monty - name: Filter by path for a pull request - if: ${{ github.event_name == 'pull_request' }} id: filter_by_path_pr working-directory: tbp.monty run: | @@ -90,27 +129,12 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs-check.yml ]] || - [[ $changed_file == .github/workflows/docs-preview.yml ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - - name: Filter by path for a push - if: ${{ github.event_name == 'push' }} - id: filter_by_path_push - working-directory: tbp.monty - run: | - git diff --name-only ${{ github.sha }}^1 > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]]; then + [[ $changed_file == .github/workflows/docs* ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi done < changed_files.txt - name: Should run id: should_run - if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' || steps.filter_by_path_push.outputs.should_run_docs == 'true'}} + if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' }} run: echo "should_run_docs=true" >> $GITHUB_OUTPUT From bef5d17a6a01c0d5a4c754df368f6cde4ba141b1 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:34:58 -0800 Subject: [PATCH 31/59] action --- .github/workflows/docs-check.yml | 1 + .github/workflows/docs-preview.yml | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs-check.yml index bbe275bc..5b18a3f6 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs-check.yml @@ -69,6 +69,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest + # TODO uncomment # if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 866604dd..b7f3f2df 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -5,7 +5,8 @@ concurrency: cancel-in-progress: true on: - pull_request_target: + # TODO change to pull_request_target + pull_request: branches: - main @@ -109,6 +110,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest + # TODO uncomment # if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} From 07a95f2295667b1ea508e708bb5d138d8d579871 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 16:54:04 -0800 Subject: [PATCH 32/59] action --- .github/workflows/docs-preview.yml | 52 ++++-------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index b7f3f2df..f5fb400c 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -9,16 +9,17 @@ on: pull_request: branches: - main + paths: + - 'docs/**' + - 'tools/github_readme_sync/**' + - '.github/workflows/docs-preview.yml' jobs: deploy_preview_docs: name: deploy-preview-docs runs-on: ubuntu-latest - needs: - - should_run_docs steps: - name: Create initial PR comment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: marocchino/sticky-pull-request-comment@v2 with: message: | @@ -28,24 +29,20 @@ jobs: Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. - name: Checkout tbp.monty - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true path: tbp.monty - name: Set up ~/tbp - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} run: | mkdir -p ~/tbp ln -s $GITHUB_WORKSPACE/tbp.monty ~/tbp/tbp.monty - name: Set up Python 3.8 - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} uses: actions/setup-python@v5 with: python-version: "3.8" - name: Install miniconda - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} run: | if [ ! -d ~/miniconda ] then @@ -56,7 +53,6 @@ jobs: export PATH="$HOME/miniconda/bin:$PATH" conda --version - name: Create conda environment - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty run: | export PATH="$HOME/miniconda/bin:$PATH" @@ -65,7 +61,6 @@ jobs: source activate tbp.monty pip install -e .[dev,github_readme_sync_tool,print_version_tool] - name: Get version and branch - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty run: | export PATH="$HOME/miniconda/bin:$PATH" @@ -77,7 +72,6 @@ jobs: # Get current date in ISO format echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV - name: Deploy docs - if: ${{ needs.should_run_docs.outputs.should_run_docs == 'true' }} working-directory: tbp.monty run: | export PATH="$HOME/miniconda/bin:$PATH" @@ -86,7 +80,7 @@ jobs: export IMAGE_PATH=${{ vars.IMAGE_PATH }} python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - name: Update PR comment on success - if: ${{ success() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + if: success() uses: marocchino/sticky-pull-request-comment@v2 with: message: | @@ -97,7 +91,7 @@ jobs: Last updated: ${{ env.DATE }} - name: Update PR comment on failure - if: ${{ failure() && needs.should_run_docs.outputs.should_run_docs == 'true' }} + if: failure() uses: marocchino/sticky-pull-request-comment@v2 with: message: | @@ -106,37 +100,3 @@ jobs: ❌ Failed to build documentation preview. Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details. - - should_run_docs: - name: should-run-docs - runs-on: ubuntu-latest - # TODO uncomment - # if: ${{ github.repository_owner == 'thousandbrainsproject' }} - outputs: - should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} - steps: - - name: Checkout tbp.monty - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - - name: Filter by path for a pull request - id: filter_by_path_pr - working-directory: tbp.monty - run: | - git diff --name-only origin/${{ github.base_ref }} > changed_files.txt - while IFS= read -r changed_file - do - echo $changed_file - if [[ $changed_file == docs/* ]] || - [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs* ]]; then - echo "should_run_docs=true" >> $GITHUB_OUTPUT - exit 0 - fi - done < changed_files.txt - - name: Should run - id: should_run - if: ${{ steps.filter_by_path_pr.outputs.should_run_docs == 'true' }} - run: echo "should_run_docs=true" >> $GITHUB_OUTPUT From a2c0562d9762d2b979da0892b55136e08ff76c10 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:30:19 -0800 Subject: [PATCH 33/59] action --- .github/actions/pin_comment/action.yml | 50 ++++++++++++++++++++++++++ .github/workflows/docs-preview.yml | 15 ++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 .github/actions/pin_comment/action.yml diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml new file mode 100644 index 00000000..62bc660b --- /dev/null +++ b/.github/actions/pin_comment/action.yml @@ -0,0 +1,50 @@ +name: "Pin Comment" +description: "Pins a comment by hiding it with HTML comments and a unique ID" + +inputs: + message: + description: "The message to pin" + required: true + token: + description: "GitHub token" + required: true + issue_number: + description: "The issue or PR number" + required: true + comment_id: + description: "Unique identifier for this pinned comment" + required: true + +runs: + using: "composite" + steps: + - name: Pin comment + shell: bash + env: + GH_TOKEN: ${{ inputs.token }} + MESSAGE: ${{ inputs.message }} + ISSUE_NUMBER: ${{ inputs.issue_number }} + COMMENT_ID: ${{ inputs.comment_id }} + run: | + # Create comment with hidden marker and ID + COMMENT=" + ${MESSAGE}" + + # Find and delete old comment with same ID + gh api graphql -f query=' + query($owner:String!, $repo:String!, $number:Int!) { + repository(owner:$owner, name:$repo) { + issueOrPullRequest(number:$number) { + ... on Issue { comments(first:100) { nodes { id body } } } + ... on PullRequest { comments(first:100) { nodes { id body } } } + } + } + }' -f owner="${GITHUB_REPOSITORY%/*}" -f repo="${GITHUB_REPOSITORY#*/}" -f number="${ISSUE_NUMBER}" | + jq -r ".data.repository.issueOrPullRequest.comments.nodes[] | select(.body | startswith(\"\")) | .id" | + while read -r comment_id; do + gh api --method DELETE "/graphql" -f query="mutation { deleteIssueComment(input: {id: \"$comment_id\"}) { clientMutationId } }" + done + + # Create new pinned comment + gh issue comment "${ISSUE_NUMBER}" --body "${COMMENT}" + diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index f5fb400c..ea305d8c 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -20,8 +20,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Create initial PR comment - uses: marocchino/sticky-pull-request-comment@v2 + uses: ./.github/actions/pin_comment with: + token: ${{ secrets.GITHUB_TOKEN }} + issue_number: ${{ github.event.pull_request.number }} + comment_id: docs-preview message: | 📚 **Documentation Preview** @@ -81,8 +84,11 @@ jobs: python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - name: Update PR comment on success if: success() - uses: marocchino/sticky-pull-request-comment@v2 + uses: ./.github/actions/pin_comment with: + token: ${{ secrets.GITHUB_TOKEN }} + issue_number: ${{ github.event.pull_request.number }} + comment_id: docs-preview message: | 📚 **Documentation Preview** @@ -92,8 +98,11 @@ jobs: Last updated: ${{ env.DATE }} - name: Update PR comment on failure if: failure() - uses: marocchino/sticky-pull-request-comment@v2 + uses: ./.github/actions/pin_comment with: + token: ${{ secrets.GITHUB_TOKEN }} + issue_number: ${{ github.event.pull_request.number }} + comment_id: docs-preview message: | 📚 **Documentation Preview** From a9868a4161a76c6262aa259d0af97ba31e559078 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:31:59 -0800 Subject: [PATCH 34/59] action --- .github/workflows/docs-preview.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index ea305d8c..a3755635 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -19,6 +19,12 @@ jobs: name: deploy-preview-docs runs-on: ubuntu-latest steps: + - name: Checkout tbp.monty + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + path: tbp.monty - name: Create initial PR comment uses: ./.github/actions/pin_comment with: @@ -31,12 +37,6 @@ jobs: Building documentation preview... ⏳ Check the [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for progress. - - name: Checkout tbp.monty - uses: actions/checkout@v4 - with: - fetch-depth: 0 - lfs: true - path: tbp.monty - name: Set up ~/tbp run: | mkdir -p ~/tbp From afdff48444d5e75b3101d96273ea4583528274dc Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:34:52 -0800 Subject: [PATCH 35/59] action --- .github/workflows/docs-preview.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index a3755635..c8ad3e7c 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -25,8 +25,9 @@ jobs: fetch-depth: 0 lfs: true path: tbp.monty + - name: Create initial PR comment - uses: ./.github/actions/pin_comment + uses: ./tbp.monty/.github/actions/pin_comment with: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} @@ -84,7 +85,7 @@ jobs: python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" - name: Update PR comment on success if: success() - uses: ./.github/actions/pin_comment + uses: ./tbp.monty/.github/actions/pin_comment with: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} @@ -98,7 +99,7 @@ jobs: Last updated: ${{ env.DATE }} - name: Update PR comment on failure if: failure() - uses: ./.github/actions/pin_comment + uses: ./tbp.monty/.github/actions/pin_comment with: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} From 8ea1e7891e90c9f5cea7d6a721f1a902f5e44642 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:38:09 -0800 Subject: [PATCH 36/59] action --- .github/actions/pin_comment/action.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 62bc660b..b406317a 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -32,19 +32,23 @@ runs: # Find and delete old comment with same ID gh api graphql -f query=' - query($owner:String!, $repo:String!, $number:Int!) { + query($owner:String!, $repo:String!, $issue:Int!) { repository(owner:$owner, name:$repo) { - issueOrPullRequest(number:$number) { + issueOrPullRequest(number:$issue) { ... on Issue { comments(first:100) { nodes { id body } } } ... on PullRequest { comments(first:100) { nodes { id body } } } } } - }' -f owner="${GITHUB_REPOSITORY%/*}" -f repo="${GITHUB_REPOSITORY#*/}" -f number="${ISSUE_NUMBER}" | - jq -r ".data.repository.issueOrPullRequest.comments.nodes[] | select(.body | startswith(\"\")) | .id" | - while read -r comment_id; do - gh api --method DELETE "/graphql" -f query="mutation { deleteIssueComment(input: {id: \"$comment_id\"}) { clientMutationId } }" - done + }' -f owner="${GITHUB_REPOSITORY%/*}" -f repo="${GITHUB_REPOSITORY#*/}" -f issue="${ISSUE_NUMBER}" > query_result.json + + if [ -s query_result.json ]; then + cat query_result.json | jq -r ".data.repository.issueOrPullRequest.comments.nodes[] | select(.body | startswith(\"\")) | .id" | + while read -r comment_id; do + if [ ! -z "$comment_id" ]; then + gh api --method DELETE "/graphql" -f query="mutation { deleteIssueComment(input: {id: \"$comment_id\"}) { clientMutationId } }" + fi + done + fi # Create new pinned comment gh issue comment "${ISSUE_NUMBER}" --body "${COMMENT}" - From 7db686ab6e48ec9e46534c634fc9dce4ba8aaa67 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:39:00 -0800 Subject: [PATCH 37/59] action --- .github/actions/pin_comment/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index b406317a..ef84ebd3 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -32,7 +32,7 @@ runs: # Find and delete old comment with same ID gh api graphql -f query=' - query($owner:String!, $repo:String!, $issue:Int!) { + query($owner:String!, $repo:String!, $issue:String!) { repository(owner:$owner, name:$repo) { issueOrPullRequest(number:$issue) { ... on Issue { comments(first:100) { nodes { id body } } } From 1ba3a546cec9574f096614e1a61537e840956842 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:39:51 -0800 Subject: [PATCH 38/59] action --- .github/actions/pin_comment/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index ef84ebd3..b406317a 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -32,7 +32,7 @@ runs: # Find and delete old comment with same ID gh api graphql -f query=' - query($owner:String!, $repo:String!, $issue:String!) { + query($owner:String!, $repo:String!, $issue:Int!) { repository(owner:$owner, name:$repo) { issueOrPullRequest(number:$issue) { ... on Issue { comments(first:100) { nodes { id body } } } From db1cf5c7af248fcfe0631abcd7b69af20068395f Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:40:55 -0800 Subject: [PATCH 39/59] action --- .github/actions/pin_comment/action.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index b406317a..b75b9d7e 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -31,23 +31,13 @@ runs: ${MESSAGE}" # Find and delete old comment with same ID - gh api graphql -f query=' - query($owner:String!, $repo:String!, $issue:Int!) { - repository(owner:$owner, name:$repo) { - issueOrPullRequest(number:$issue) { - ... on Issue { comments(first:100) { nodes { id body } } } - ... on PullRequest { comments(first:100) { nodes { id body } } } - } - } - }' -f owner="${GITHUB_REPOSITORY%/*}" -f repo="${GITHUB_REPOSITORY#*/}" -f issue="${ISSUE_NUMBER}" > query_result.json - - if [ -s query_result.json ]; then - cat query_result.json | jq -r ".data.repository.issueOrPullRequest.comments.nodes[] | select(.body | startswith(\"\")) | .id" | - while read -r comment_id; do - if [ ! -z "$comment_id" ]; then - gh api --method DELETE "/graphql" -f query="mutation { deleteIssueComment(input: {id: \"$comment_id\"}) { clientMutationId } }" - fi - done + # Get all comments and find the one with our marker + comments=$(gh api "/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") + old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") + + # Delete old comment if found + if [ ! -z "$old_comment_id" ]; then + gh api -X DELETE "/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" fi # Create new pinned comment From 62ca765fa3cd3d20b95ea30f9ae566001a9e5dc8 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:42:13 -0800 Subject: [PATCH 40/59] action --- .github/actions/pin_comment/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index b75b9d7e..7dd6a3a6 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -18,6 +18,9 @@ inputs: runs: using: "composite" steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Pin comment shell: bash env: From 4282f77cbc19c7c1b385b296cc6589c098a20a6b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:45:49 -0800 Subject: [PATCH 41/59] action --- .github/actions/pin_comment/action.yml | 10 +++++++--- .github/workflows/docs-preview.yml | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 7dd6a3a6..8c99ad02 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -14,13 +14,13 @@ inputs: comment_id: description: "Unique identifier for this pinned comment" required: true + working_directory: + description: "Path to the repository working directory" + required: true runs: using: "composite" steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Pin comment shell: bash env: @@ -28,7 +28,11 @@ runs: MESSAGE: ${{ inputs.message }} ISSUE_NUMBER: ${{ inputs.issue_number }} COMMENT_ID: ${{ inputs.comment_id }} + WORKING_DIRECTORY: ${{ inputs.working_directory }} run: | + # Change to working directory + cd "${WORKING_DIRECTORY}" + # Create comment with hidden marker and ID COMMENT=" ${MESSAGE}" diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index c8ad3e7c..85c9de18 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -32,6 +32,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} comment_id: docs-preview + working_directory: tbp.monty message: | 📚 **Documentation Preview** @@ -90,6 +91,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} comment_id: docs-preview + working_directory: tbp.monty message: | 📚 **Documentation Preview** @@ -104,6 +106,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} issue_number: ${{ github.event.pull_request.number }} comment_id: docs-preview + working_directory: tbp.monty message: | 📚 **Documentation Preview** From b57e49bedba718fcbdeb27fe8a8fcbab7bc62b6b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:46:52 -0800 Subject: [PATCH 42/59] action --- .github/actions/pin_comment/action.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 8c99ad02..34d4b78d 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -24,7 +24,7 @@ runs: - name: Pin comment shell: bash env: - GH_TOKEN: ${{ inputs.token }} + GITHUB_TOKEN: ${{ inputs.token }} MESSAGE: ${{ inputs.message }} ISSUE_NUMBER: ${{ inputs.issue_number }} COMMENT_ID: ${{ inputs.comment_id }} @@ -37,15 +37,20 @@ runs: COMMENT=" ${MESSAGE}" - # Find and delete old comment with same ID + # Find and delete old comment with same ID using GitHub token # Get all comments and find the one with our marker - comments=$(gh api "/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") + comments=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") # Delete old comment if found if [ ! -z "$old_comment_id" ]; then - gh api -X DELETE "/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" + curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" fi - # Create new pinned comment - gh issue comment "${ISSUE_NUMBER}" --body "${COMMENT}" + # Create new pinned comment using GitHub API directly + curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"body\":\"${COMMENT}\"}" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" From fe546238afcb214ac87dbff54e7282569bf7de75 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:49:02 -0800 Subject: [PATCH 43/59] action --- .github/workflows/docs-preview.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 85c9de18..f0eac8af 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -14,6 +14,9 @@ on: - 'tools/github_readme_sync/**' - '.github/workflows/docs-preview.yml' +permissions: + pull-requests: write + jobs: deploy_preview_docs: name: deploy-preview-docs From 462dd1f268011ef052f72b49e1495649d4db6995 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:50:43 -0800 Subject: [PATCH 44/59] action --- .github/actions/pin_comment/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 34d4b78d..5baacc37 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -18,6 +18,9 @@ inputs: description: "Path to the repository working directory" required: true +permissions: + pull-requests: write + runs: using: "composite" steps: From 2929b52b7b1671ad0429ed9ac79a4dba95f4d62f Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:53:24 -0800 Subject: [PATCH 45/59] action --- .github/actions/pin_comment/action.yml | 1 + .github/workflows/docs-preview.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 5baacc37..65ad372c 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -20,6 +20,7 @@ inputs: permissions: pull-requests: write + issues: write runs: using: "composite" diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index f0eac8af..1d99b6d2 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -16,6 +16,7 @@ on: permissions: pull-requests: write + issues: write jobs: deploy_preview_docs: From a3a6b831d8dce2cfd0399fac1e12032aceda5927 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 19:55:30 -0800 Subject: [PATCH 46/59] action --- .github/actions/pin_comment/action.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 65ad372c..5a84b708 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -26,7 +26,7 @@ runs: using: "composite" steps: - name: Pin comment - shell: bash + shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0} env: GITHUB_TOKEN: ${{ inputs.token }} MESSAGE: ${{ inputs.message }} @@ -53,8 +53,11 @@ runs: "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" fi + # Escape newlines and quotes in comment for JSON + ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') + # Create new pinned comment using GitHub API directly curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ - -d "{\"body\":\"${COMMENT}\"}" \ + -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" From 34a399b37f672f9ac62cd43fd5fd68fb084bf0ef Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:02:15 -0800 Subject: [PATCH 47/59] action --- .github/actions/pin_comment/action.yml | 12 ++++-------- .github/workflows/docs-preview.yml | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 5a84b708..43be3fea 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -18,10 +18,6 @@ inputs: description: "Path to the repository working directory" required: true -permissions: - pull-requests: write - issues: write - runs: using: "composite" steps: @@ -36,17 +32,17 @@ runs: run: | # Change to working directory cd "${WORKING_DIRECTORY}" - + # Create comment with hidden marker and ID COMMENT=" ${MESSAGE}" - + # Find and delete old comment with same ID using GitHub token # Get all comments and find the one with our marker comments=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") - + # Delete old comment if found if [ ! -z "$old_comment_id" ]; then curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" \ @@ -55,7 +51,7 @@ runs: # Escape newlines and quotes in comment for JSON ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') - + # Create new pinned comment using GitHub API directly curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 1d99b6d2..ce8c7381 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -15,7 +15,6 @@ on: - '.github/workflows/docs-preview.yml' permissions: - pull-requests: write issues: write jobs: From eae7161002218dfa7cddded2ef3cb18c5683cd8d Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:02:56 -0800 Subject: [PATCH 48/59] action --- .github/workflows/docs-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index ce8c7381..f0eac8af 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -15,7 +15,7 @@ on: - '.github/workflows/docs-preview.yml' permissions: - issues: write + pull-requests: write jobs: deploy_preview_docs: From 3140ca47f587125d74d5b5c03ffe862525babfab Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:06:19 -0800 Subject: [PATCH 49/59] action --- .github/actions/pin_comment/action.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 43be3fea..ce298b58 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -30,30 +30,47 @@ runs: COMMENT_ID: ${{ inputs.comment_id }} WORKING_DIRECTORY: ${{ inputs.working_directory }} run: | + echo "Debug: Starting pin comment action" + echo "Debug: Working directory: ${WORKING_DIRECTORY}" + echo "Debug: Issue number: ${ISSUE_NUMBER}" + echo "Debug: Comment ID: ${COMMENT_ID}" + # Change to working directory cd "${WORKING_DIRECTORY}" + echo "Debug: Changed to working directory" # Create comment with hidden marker and ID COMMENT=" ${MESSAGE}" + echo "Debug: Created comment with marker" # Find and delete old comment with same ID using GitHub token # Get all comments and find the one with our marker + echo "Debug: Fetching existing comments" comments=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") + + echo "Debug: Found old comment ID: ${old_comment_id:-none}" # Delete old comment if found if [ ! -z "$old_comment_id" ]; then + echo "Debug: Deleting old comment with ID: ${old_comment_id}" curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" + echo "Debug: Deleted old comment" + else + echo "Debug: No old comment found to delete" fi # Escape newlines and quotes in comment for JSON ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') + echo "Debug: Escaped comment for JSON" # Create new pinned comment using GitHub API directly + echo "Debug: Creating new comment" curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" + echo "Debug: Created new comment successfully" From d8b9dd67afd312822c9748c208044448e3593f12 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:10:23 -0800 Subject: [PATCH 50/59] action --- .github/actions/pin_comment/action.yml | 30 +++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index ce298b58..7c319595 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -53,24 +53,20 @@ runs: echo "Debug: Found old comment ID: ${old_comment_id:-none}" - # Delete old comment if found + # Update old comment if found if [ ! -z "$old_comment_id" ]; then - echo "Debug: Deleting old comment with ID: ${old_comment_id}" - curl -X DELETE -H "Authorization: token ${GITHUB_TOKEN}" \ + echo "Debug: Updating old comment with ID: ${old_comment_id}" + curl -X PATCH -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" - echo "Debug: Deleted old comment" + echo "Debug: Updated old comment successfully" else - echo "Debug: No old comment found to delete" + # Create new pinned comment using GitHub API directly + echo "Debug: Creating new comment" + curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"body\":${ESCAPED_COMMENT}}" \ + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" + echo "Debug: Created new comment successfully" fi - - # Escape newlines and quotes in comment for JSON - ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') - echo "Debug: Escaped comment for JSON" - - # Create new pinned comment using GitHub API directly - echo "Debug: Creating new comment" - curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ - -H "Content-Type: application/json" \ - -d "{\"body\":${ESCAPED_COMMENT}}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" - echo "Debug: Created new comment successfully" From 4a8d92b420ff0700796468174d72174661241b5f Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:12:21 -0800 Subject: [PATCH 51/59] action --- .github/actions/pin_comment/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 7c319595..53ae28a3 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -44,6 +44,9 @@ runs: ${MESSAGE}" echo "Debug: Created comment with marker" + # Properly escape the comment for JSON + ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') + # Find and delete old comment with same ID using GitHub token # Get all comments and find the one with our marker echo "Debug: Fetching existing comments" From 2e3c14516865d13c37757ca373cc2465d6f77a45 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:29:15 -0800 Subject: [PATCH 52/59] code review changes --- .github/actions/pin_comment/action.yml | 18 +++--------------- .github/workflows/docs-preview.yml | 14 +++++++------- .github/workflows/{docs-check.yml => docs.yml} | 2 +- 3 files changed, 11 insertions(+), 23 deletions(-) rename .github/workflows/{docs-check.yml => docs.yml} (99%) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 53ae28a3..90266761 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -30,46 +30,34 @@ runs: COMMENT_ID: ${{ inputs.comment_id }} WORKING_DIRECTORY: ${{ inputs.working_directory }} run: | - echo "Debug: Starting pin comment action" - echo "Debug: Working directory: ${WORKING_DIRECTORY}" - echo "Debug: Issue number: ${ISSUE_NUMBER}" - echo "Debug: Comment ID: ${COMMENT_ID}" - # Change to working directory cd "${WORKING_DIRECTORY}" - echo "Debug: Changed to working directory" # Create comment with hidden marker and ID COMMENT=" ${MESSAGE}" - echo "Debug: Created comment with marker" # Properly escape the comment for JSON ESCAPED_COMMENT=$(echo "$COMMENT" | jq -R -s '.') # Find and delete old comment with same ID using GitHub token - # Get all comments and find the one with our marker - echo "Debug: Fetching existing comments" + echo "Searching for existing pinned comment with ID: ${COMMENT_ID}" comments=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") - - echo "Debug: Found old comment ID: ${old_comment_id:-none}" # Update old comment if found if [ ! -z "$old_comment_id" ]; then - echo "Debug: Updating old comment with ID: ${old_comment_id}" + echo "Updating existing comment with ID: ${old_comment_id}" curl -X PATCH -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" - echo "Debug: Updated old comment successfully" else # Create new pinned comment using GitHub API directly - echo "Debug: Creating new comment" + echo "Creating new pinned comment" curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" - echo "Debug: Created new comment successfully" fi diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index f0eac8af..5b0afbbf 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -18,8 +18,8 @@ permissions: pull-requests: write jobs: - deploy_preview_docs: - name: deploy-preview-docs + deploy_docs_preview: + name: deploy-docs-preview runs-on: ubuntu-latest steps: - name: Checkout tbp.monty @@ -73,12 +73,12 @@ jobs: run: | export PATH="$HOME/miniconda/bin:$PATH" source activate tbp.monty - echo "VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV + echo "MONTY_VERSION=$(python -m tools.print_version.cli minor)" >> $GITHUB_ENV # Make branch name safe for semver by replacing invalid chars with dash # Remove trailing dash if present echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr -c '[:alnum:]' '-' | sed 's/-*$//')" >> $GITHUB_ENV # Get current date in ISO format - echo "DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV + echo "MONTY_DATE=$(date -u +'%Y-%m-%d %H:%M UTC')" >> $GITHUB_ENV - name: Deploy docs working-directory: tbp.monty run: | @@ -86,7 +86,7 @@ jobs: source activate tbp.monty export README_API_KEY=${{ secrets.README_API_KEY }} export IMAGE_PATH=${{ vars.IMAGE_PATH }} - python -m tools.github_readme_sync.cli upload docs "${VERSION}-${BRANCH_NAME}" + python -m tools.github_readme_sync.cli upload docs "${MONTY_VERSION}-${BRANCH_NAME}" - name: Update PR comment on success if: success() uses: ./tbp.monty/.github/actions/pin_comment @@ -99,9 +99,9 @@ jobs: 📚 **Documentation Preview** ✅ A preview of the documentation changes in this PR is available for maintainers at: - ${{ vars.DOCS_URL_PREFIX }}v${{ env.VERSION }}-${{ env.BRANCH_NAME }} + ${{ vars.DOCS_URL_PREFIX }}v${{ env.MONTY_VERSION }}-${{ env.BRANCH_NAME }} - Last updated: ${{ env.DATE }} + Last updated: ${{ env.MONTY_DATE }} - name: Update PR comment on failure if: failure() uses: ./tbp.monty/.github/actions/pin_comment diff --git a/.github/workflows/docs-check.yml b/.github/workflows/docs.yml similarity index 99% rename from .github/workflows/docs-check.yml rename to .github/workflows/docs.yml index 5b18a3f6..5db0f1ad 100644 --- a/.github/workflows/docs-check.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,4 @@ -name: Docs Check +name: Docs concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} From da6cccf5236a4fe7f42d40dfda353234b4553ba1 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:31:43 -0800 Subject: [PATCH 53/59] action --- .github/actions/pin_comment/action.yml | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 90266761..a11f4bae 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -42,22 +42,42 @@ runs: # Find and delete old comment with same ID using GitHub token echo "Searching for existing pinned comment with ID: ${COMMENT_ID}" - comments=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ + response=$(curl -s -w "%{http_code}" -H "Authorization: token ${GITHUB_TOKEN}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") + status_code=${response: -3} + comments=${response:0:-3} + + if [ "$status_code" != "200" ]; then + echo "Failed to fetch comments. Status code: ${status_code}" + exit 1 + fi + old_comment_id=$(echo "$comments" | jq -r ".[] | select(.body | startswith(\"\")) | .id") # Update old comment if found if [ ! -z "$old_comment_id" ]; then echo "Updating existing comment with ID: ${old_comment_id}" - curl -X PATCH -H "Authorization: token ${GITHUB_TOKEN}" \ + response=$(curl -s -w "%{http_code}" -X PATCH -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"body\":${ESCAPED_COMMENT}}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}" + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}") + status_code=${response: -3} + + if [ "$status_code" != "200" ]; then + echo "Failed to update comment. Status code: ${status_code}" + exit 1 + fi else # Create new pinned comment using GitHub API directly echo "Creating new pinned comment" - curl -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ + response=$(curl -s -w "%{http_code}" -X POST -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"body\":${ESCAPED_COMMENT}}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments" + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") + status_code=${response: -3} + + if [ "$status_code" != "201" ]; then + echo "Failed to create comment. Status code: ${status_code}" + exit 1 + fi fi From 1ef1bbf2af4e79185833e71586a5eeb9f4255a0b Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:33:38 -0800 Subject: [PATCH 54/59] action --- .github/actions/pin_comment/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index a11f4bae..717c2bf5 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -46,7 +46,7 @@ runs: "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") status_code=${response: -3} comments=${response:0:-3} - + if [ "$status_code" != "200" ]; then echo "Failed to fetch comments. Status code: ${status_code}" exit 1 @@ -62,7 +62,7 @@ runs: -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/comments/${old_comment_id}") status_code=${response: -3} - + if [ "$status_code" != "200" ]; then echo "Failed to update comment. Status code: ${status_code}" exit 1 @@ -75,7 +75,7 @@ runs: -d "{\"body\":${ESCAPED_COMMENT}}" \ "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") status_code=${response: -3} - + if [ "$status_code" != "201" ]; then echo "Failed to create comment. Status code: ${status_code}" exit 1 From 1382d22d46acacc5169c06485122f542a0a464b5 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:35:20 -0800 Subject: [PATCH 55/59] todos --- .github/workflows/docs-preview.yml | 3 +-- .github/workflows/docs.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 5b0afbbf..e297052c 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -5,8 +5,7 @@ concurrency: cancel-in-progress: true on: - # TODO change to pull_request_target - pull_request: + pull_request_target: branches: - main paths: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5db0f1ad..f9f9ca6a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -69,8 +69,7 @@ jobs: should_run_docs: name: should-run-docs runs-on: ubuntu-latest - # TODO uncomment - # if: ${{ github.repository_owner == 'thousandbrainsproject' }} + if: ${{ github.repository_owner == 'thousandbrainsproject' }} outputs: should_run_docs: ${{ steps.should_run.outputs.should_run_docs }} steps: From 79919712f150eb258b0173940910228c6eabdee7 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Tue, 7 Jan 2025 20:47:30 -0800 Subject: [PATCH 56/59] wrong yml file --- .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 f9f9ca6a..786b981f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -90,7 +90,7 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs-check.yml ]] || + [[ $changed_file == .github/workflows/docs.yml ]] || [[ $changed_file == .github/workflows/docs-preview.yml ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 From 1c6729085b44821d083da1241b131162adac03f4 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Thu, 9 Jan 2025 14:10:49 -0800 Subject: [PATCH 57/59] kebab, pinned comment page length --- .github/actions/pin_comment/action.yml | 2 +- .github/workflows/docs-preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/pin_comment/action.yml b/.github/actions/pin_comment/action.yml index 717c2bf5..76411b5e 100644 --- a/.github/actions/pin_comment/action.yml +++ b/.github/actions/pin_comment/action.yml @@ -43,7 +43,7 @@ runs: # Find and delete old comment with same ID using GitHub token echo "Searching for existing pinned comment with ID: ${COMMENT_ID}" response=$(curl -s -w "%{http_code}" -H "Authorization: token ${GITHUB_TOKEN}" \ - "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments") + "https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${ISSUE_NUMBER}/comments?per_page=100") status_code=${response: -3} comments=${response:0:-3} diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index e297052c..9856a152 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -11,7 +11,7 @@ on: paths: - 'docs/**' - 'tools/github_readme_sync/**' - - '.github/workflows/docs-preview.yml' + - '.github/workflows/docs_preview.yml' permissions: pull-requests: write From e2b98f53b810b2b617eb6c25d532920c5c7c0fd3 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Thu, 9 Jan 2025 14:18:02 -0800 Subject: [PATCH 58/59] renamed --- .github/workflows/{docs-preview.yml => docs_preview.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docs-preview.yml => docs_preview.yml} (100%) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs_preview.yml similarity index 100% rename from .github/workflows/docs-preview.yml rename to .github/workflows/docs_preview.yml From 860e9cf6fd30877a7ae8e030c9f407675ec84ca4 Mon Sep 17 00:00:00 2001 From: codeallthethingz Date: Thu, 9 Jan 2025 14:20:53 -0800 Subject: [PATCH 59/59] don't run preview when docs.yml changes --- .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 786b981f..7b0684da 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -90,8 +90,7 @@ jobs: echo $changed_file if [[ $changed_file == docs/* ]] || [[ $changed_file == tools/github_readme_sync/* ]] || - [[ $changed_file == .github/workflows/docs.yml ]] || - [[ $changed_file == .github/workflows/docs-preview.yml ]]; then + [[ $changed_file == .github/workflows/docs.yml ]]; then echo "should_run_docs=true" >> $GITHUB_OUTPUT exit 0 fi