From eb9e8e8a878bf360268be6c8feddbed0f31643cb Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Tue, 5 Aug 2025 16:28:43 -0500 Subject: [PATCH 1/4] Update pre-commit workflow; add @andrewdnolan --- .../workflows/pre_commit_update_workflow.yml | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pre_commit_update_workflow.yml b/.github/workflows/pre_commit_update_workflow.yml index 25dafcc7f..16a8545a3 100644 --- a/.github/workflows/pre_commit_update_workflow.yml +++ b/.github/workflows/pre_commit_update_workflow.yml @@ -9,10 +9,13 @@ on: # 4. Entry: Month of the year when the process will be started [1-12] # 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday] - cron: '0 8 * * 3' + # Allow manual triggering of the workflow + workflow_dispatch: env: UP_TO_DATE: false - PYTHON_VERSION: "3.10" + PYTHON_VERSION: "3.13" + REVIEWERS: "altheaden,xylar,andrewdnolan" jobs: auto-update: @@ -20,16 +23,30 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Set up Conda Environment + uses: mamba-org/setup-micromamba@v2 with: - python-version: ${{ env.PYTHON_VERSION }} + environment-name: pre_commit_dev + init-shell: bash + condarc: | + channel_priority: strict + channels: + - conda-forge + create-args: >- + python=${{ env.PYTHON_VERSION }} - - name: Install pre-commit - run: pip install pre-commit + - name: Install pre-commit and gh + run: | + eval "$(micromamba shell hook --shell bash)" + micromamba activate pre_commit_dev + # permissions issue with gh 2.76.0 + conda install -y pre-commit "gh !=2.76.0" + gh --version - name: Apply and commit updates run: | + eval "$(micromamba shell hook --shell bash)" + micromamba activate pre_commit_dev git clone https://github.com/MPAS-Dev/MPAS-Tools.git update-pre-commit-deps cd update-pre-commit-deps # Configure git using GitHub Actions credentials. @@ -60,7 +77,7 @@ jobs: --title "Update pre-commit and its dependencies" \ --body "This PR was auto-generated to update pre-commit and its dependencies." \ --head update-pre-commit-deps \ - --reviewer altheaden,xylar \ + --reviewer ${{ env.REVIEWERS }} \ --label ci env: GH_TOKEN: ${{ github.token }} From 91277c5a4278e34796041b6d8629b74b697baf1f Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Tue, 5 Aug 2025 16:30:39 -0500 Subject: [PATCH 2/4] Add @andrewdnolan to dependabot reviewers --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e6d4748ed..5007bece6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,4 +11,5 @@ updates: reviewers: - "xylar" - "altheaden" + - "andrewdnolan" From 10e8fd7e45b964ee3237653407da9d4e1d286491 Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Tue, 5 Aug 2025 16:33:30 -0500 Subject: [PATCH 3/4] Add python version var to build workflow --- .github/workflows/build_workflow.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_workflow.yml b/.github/workflows/build_workflow.yml index e992ed0c8..cffbebb40 100644 --- a/.github/workflows/build_workflow.yml +++ b/.github/workflows/build_workflow.yml @@ -26,6 +26,7 @@ on: env: CANCEL_OTHERS: false PATHS_IGNORE: '["**/README.md", "**/docs/**"]' + PYTHON_VERSION: "3.13" jobs: pre-commit-hooks: @@ -36,10 +37,10 @@ jobs: - name: Checkout Code Repository uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: ${{ env.PYTHON_VERSION }} - id: file_changes uses: trilom/file-changes-action@1.2.4 From b6566e293a8b8a91ee3091c1103134d9f4fe1a65 Mon Sep 17 00:00:00 2001 From: Althea Denlinger Date: Tue, 5 Aug 2025 16:45:52 -0500 Subject: [PATCH 4/4] Add auto-closing of existing pre-commit PRs --- .github/workflows/pre_commit_update_workflow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pre_commit_update_workflow.yml b/.github/workflows/pre_commit_update_workflow.yml index 16a8545a3..8f3631a23 100644 --- a/.github/workflows/pre_commit_update_workflow.yml +++ b/.github/workflows/pre_commit_update_workflow.yml @@ -73,6 +73,10 @@ jobs: if: ${{ env.UP_TO_DATE == 'false' }} run: | cd update-pre-commit-deps + # Close any existing PR and replace with most up-to-date changes + gh pr close update-pre-commit-deps \ + --comment "This PR was closed to create a new, updated PR." || \ + echo "No existing PR to close and replace." gh pr create \ --title "Update pre-commit and its dependencies" \ --body "This PR was auto-generated to update pre-commit and its dependencies." \