From ca63feed045ef8ddccc1e20d30f05791aced0cf3 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:01:31 -0400 Subject: [PATCH 01/10] Create ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .github/workflows/ai_pytest_workflow.yaml diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml new file mode 100644 index 000000000..74922e288 --- /dev/null +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -0,0 +1,71 @@ +name: AI Pytest Workflow + +on: + pull_request: + branches: [ main ] + # schedule: + # - cron: '0 0 * * *' # Runs once a day at midnight + +jobs: + ai-pytest-check: + runs-on: ubuntu-latest + + # Required for conda-incubator to work correctly in the runner + defaults: + run: + shell: bash -el {0} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Conda environment + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + python-version: '3.10' # Adjust based on fre-cli's requirements + activate-environment: fre-cli-dev + + - name: Install fre-cli (Developer Style) + run: | + # Upgrade pip and install standard test requirements + python -m pip install --upgrade pip + pip install pytest + + # Editable pip install as requested + pip install -e . + + - name: Run Pytest and capture output + run: | + # Run pytest and pipe output to a file. + # Using `|| true` ensures the workflow continues even if tests fail/warn. + pytest > pytest_output.log 2>&1 || true + + echo "Captured Pytest Output:" + cat pytest_output.log + + - name: Setup GitHub Copilot CLI + env: + # A token is required to authenticate the GitHub CLI extension + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # The GitHub CLI (gh) is pre-installed on standard Ubuntu runners. + # We install the official Copilot extension here. + gh extension install github/gh-copilot + + echo "Testing Copilot Help Command:" + gh copilot --help + + - name: Query Copilot for Fixes + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Read the pytest output into a variable + # You might want to filter this with grep if the log is too long for the prompt limit + TEST_OUTPUT=$(cat pytest_output.log) + + echo "Feeding pytest output to Copilot..." + + # Pass the prompt and the context to Copilot + # Note: `gh copilot suggest` is usually interactive, but we feed it as a single string here + gh copilot suggest -t shell "Fix these warnings/errors from pytest: $TEST_OUTPUT" From 748e202c00863697879bb51ab681075ab7f962a1 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:07:30 -0400 Subject: [PATCH 02/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 74922e288..c34f375f6 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -22,8 +22,11 @@ jobs: - name: Set up Conda environment uses: conda-incubator/setup-miniconda@v3 with: - auto-update-conda: true - python-version: '3.10' # Adjust based on fre-cli's requirements + miniforge-version: latest + channels: conda-forge,noaa-gfdl + python-version: 3.14 + conda-remove-defaults: true + environment-file: environment.yaml activate-environment: fre-cli-dev - name: Install fre-cli (Developer Style) From a6cef1133b5c2a02700af5d98c7e1ccc60741785 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:15:07 -0400 Subject: [PATCH 03/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index c34f375f6..2b5ed6c36 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -18,6 +18,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + submodules: recursive - name: Set up Conda environment uses: conda-incubator/setup-miniconda@v3 @@ -26,8 +28,8 @@ jobs: channels: conda-forge,noaa-gfdl python-version: 3.14 conda-remove-defaults: true - environment-file: environment.yaml - activate-environment: fre-cli-dev + environment-file: environment.yml + activate-environment: fre-cli - name: Install fre-cli (Developer Style) run: | From 2cf0f8354c9a54631f358dfa961ff809a2c68edb Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:26:25 -0400 Subject: [PATCH 04/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 2b5ed6c36..1d5802566 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -59,7 +59,7 @@ jobs: gh extension install github/gh-copilot echo "Testing Copilot Help Command:" - gh copilot --help + gh copilot -- --help - name: Query Copilot for Fixes env: @@ -67,10 +67,11 @@ jobs: run: | # Read the pytest output into a variable # You might want to filter this with grep if the log is too long for the prompt limit - TEST_OUTPUT=$(cat pytest_output.log) + TEST_OUTPUT=$(cat pytest_output.log | grep -B 5 -A 5 'warn') echo "Feeding pytest output to Copilot..." # Pass the prompt and the context to Copilot # Note: `gh copilot suggest` is usually interactive, but we feed it as a single string here - gh copilot suggest -t shell "Fix these warnings/errors from pytest: $TEST_OUTPUT" + gh copilot --prompt "Fix these warnings/errors from pytest: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --attachment pytest_output.log --attachment .github/copilot-instructions.md --model 'Claude Sonnet 4.6' --mode 'autopilot' + From 62372c34e34d7a1d42658c96c6aa9faded399dad Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:39:31 -0400 Subject: [PATCH 05/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 56 +++++++++-------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 1d5802566..41d444034 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -9,11 +9,6 @@ on: jobs: ai-pytest-check: runs-on: ubuntu-latest - - # Required for conda-incubator to work correctly in the runner - defaults: - run: - shell: bash -el {0} steps: - name: Checkout repository @@ -21,33 +16,27 @@ jobs: with: submodules: recursive - - name: Set up Conda environment - uses: conda-incubator/setup-miniconda@v3 - with: - miniforge-version: latest - channels: conda-forge,noaa-gfdl - python-version: 3.14 - conda-remove-defaults: true - environment-file: environment.yml - activate-environment: fre-cli - - - name: Install fre-cli (Developer Style) + - name: Fetch recent workflow logs from main + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Upgrade pip and install standard test requirements - python -m pip install --upgrade pip - pip install pytest + # Get the ID of the most recent workflow run on the main branch. + # Note: If you want logs from a *specific* workflow, add `--workflow "Your Workflow Name"` to this command. + RUN_ID=$(gh run list --branch main --limit 1 --json databaseId --jq '.[0].databaseId') - # Editable pip install as requested - pip install -e . - - - name: Run Pytest and capture output - run: | - # Run pytest and pipe output to a file. - # Using `|| true` ensures the workflow continues even if tests fail/warn. - pytest > pytest_output.log 2>&1 || true + if [ -z "$RUN_ID" ]; then + echo "No recent runs found on the main branch." + exit 1 + fi + + echo "Fetching logs for Run ID: $RUN_ID" - echo "Captured Pytest Output:" - cat pytest_output.log + # Download the logs and pipe output to a file. + # Using `|| true` ensures the workflow continues even if the command has a hiccup. + gh run view $RUN_ID --log > pytest_output.log || true + + echo "Captured Logs Preview:" + head -n 20 pytest_output.log - name: Setup GitHub Copilot CLI env: @@ -66,12 +55,11 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Read the pytest output into a variable - # You might want to filter this with grep if the log is too long for the prompt limit - TEST_OUTPUT=$(cat pytest_output.log | grep -B 5 -A 5 'warn') + # Filtering with grep for warnings/errors (case-insensitive) to stay within the prompt limit + TEST_OUTPUT=$(cat pytest_output.log | grep -i -E -B 5 -A 5 'warn|error|fail') - echo "Feeding pytest output to Copilot..." + echo "Feeding workflow logs to Copilot..." # Pass the prompt and the context to Copilot # Note: `gh copilot suggest` is usually interactive, but we feed it as a single string here - gh copilot --prompt "Fix these warnings/errors from pytest: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --attachment pytest_output.log --attachment .github/copilot-instructions.md --model 'Claude Sonnet 4.6' --mode 'autopilot' - + gh copilot --prompt "Fix these warnings/errors from the recent test run: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --attachment pytest_output.log --attachment .github/copilot-instructions.md --model 'Claude Sonnet 4.6' --mode 'autopilot' From 01e59ff858c89f8eacc4529868334435c659d642 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:41:36 -0400 Subject: [PATCH 06/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 41d444034..679ccb2e7 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -43,12 +43,9 @@ jobs: # A token is required to authenticate the GitHub CLI extension GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # The GitHub CLI (gh) is pre-installed on standard Ubuntu runners. - # We install the official Copilot extension here. - gh extension install github/gh-copilot - echo "Testing Copilot Help Command:" - gh copilot -- --help + echo "Testing Copilot command" + gh copilot - name: Query Copilot for Fixes env: From 0318f8e2396aa5ec3746c19a223e9d7194ee26b7 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:42:50 -0400 Subject: [PATCH 07/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 679ccb2e7..14cc54ae2 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -45,7 +45,7 @@ jobs: run: | echo "Testing Copilot command" - gh copilot + gh copilot || echo "returning 1 is OK for this line" - name: Query Copilot for Fixes env: From 678af2b692477caf16d82ba11298866c2da8779b Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:44:35 -0400 Subject: [PATCH 08/10] Update ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml index 14cc54ae2..728fa2e9e 100644 --- a/.github/workflows/ai_pytest_workflow.yaml +++ b/.github/workflows/ai_pytest_workflow.yaml @@ -59,4 +59,4 @@ jobs: # Pass the prompt and the context to Copilot # Note: `gh copilot suggest` is usually interactive, but we feed it as a single string here - gh copilot --prompt "Fix these warnings/errors from the recent test run: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --attachment pytest_output.log --attachment .github/copilot-instructions.md --model 'Claude Sonnet 4.6' --mode 'autopilot' + gh copilot --prompt "The following warnings and errors come from pytest_output.log. Fix these warnings/errors from the recent test run: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --model 'Claude Sonnet 4.6' --mode 'autopilot' From 1e0f573d286a34dc0981967b2d304b84d0958542 Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:48:05 -0400 Subject: [PATCH 09/10] Create codeql.yml --- .github/workflows/codeql.yml | 101 +++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..6ea8e53ea --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,101 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '41 3 * * 3' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: python + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" From d78bd44eb65c2a40b0c60f9987ba2a41f90ae3be Mon Sep 17 00:00:00 2001 From: "Ian L." <6273252+ilaflott@users.noreply.github.com> Date: Wed, 15 Jul 2026 12:56:21 -0400 Subject: [PATCH 10/10] Delete .github/workflows/ai_pytest_workflow.yaml --- .github/workflows/ai_pytest_workflow.yaml | 62 ----------------------- 1 file changed, 62 deletions(-) delete mode 100644 .github/workflows/ai_pytest_workflow.yaml diff --git a/.github/workflows/ai_pytest_workflow.yaml b/.github/workflows/ai_pytest_workflow.yaml deleted file mode 100644 index 728fa2e9e..000000000 --- a/.github/workflows/ai_pytest_workflow.yaml +++ /dev/null @@ -1,62 +0,0 @@ -name: AI Pytest Workflow - -on: - pull_request: - branches: [ main ] - # schedule: - # - cron: '0 0 * * *' # Runs once a day at midnight - -jobs: - ai-pytest-check: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Fetch recent workflow logs from main - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Get the ID of the most recent workflow run on the main branch. - # Note: If you want logs from a *specific* workflow, add `--workflow "Your Workflow Name"` to this command. - RUN_ID=$(gh run list --branch main --limit 1 --json databaseId --jq '.[0].databaseId') - - if [ -z "$RUN_ID" ]; then - echo "No recent runs found on the main branch." - exit 1 - fi - - echo "Fetching logs for Run ID: $RUN_ID" - - # Download the logs and pipe output to a file. - # Using `|| true` ensures the workflow continues even if the command has a hiccup. - gh run view $RUN_ID --log > pytest_output.log || true - - echo "Captured Logs Preview:" - head -n 20 pytest_output.log - - - name: Setup GitHub Copilot CLI - env: - # A token is required to authenticate the GitHub CLI extension - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - - echo "Testing Copilot command" - gh copilot || echo "returning 1 is OK for this line" - - - name: Query Copilot for Fixes - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Read the pytest output into a variable - # Filtering with grep for warnings/errors (case-insensitive) to stay within the prompt limit - TEST_OUTPUT=$(cat pytest_output.log | grep -i -E -B 5 -A 5 'warn|error|fail') - - echo "Feeding workflow logs to Copilot..." - - # Pass the prompt and the context to Copilot - # Note: `gh copilot suggest` is usually interactive, but we feed it as a single string here - gh copilot --prompt "The following warnings and errors come from pytest_output.log. Fix these warnings/errors from the recent test run: \n\n ${TEST_OUTPUT}" --add-dir "${PWD}" --allow-all --model 'Claude Sonnet 4.6' --mode 'autopilot'