From 1891310ec31d5e4e1968d8982da9f4e422eeeead Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 11:06:36 -0700 Subject: [PATCH 1/7] Add comment to src/ccpp_hash_table.F90 so that file is 'modified' --- src/ccpp_hash_table.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ccpp_hash_table.F90 b/src/ccpp_hash_table.F90 index 685c9049..af268450 100644 --- a/src/ccpp_hash_table.F90 +++ b/src/ccpp_hash_table.F90 @@ -1,6 +1,8 @@ !!XXgoldyXX: To do, statistics output module ccpp_hash_table +! Modify this file ... + use ccpp_hashable, only: ccpp_hashable_t implicit none From 4854c83c1b80800453090c2ab921bcb6176efe99 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 11:22:19 -0700 Subject: [PATCH 2/7] Update existing GitHub action workflows: concurrency, only run for PRs to develop --- .github/workflows/capgen_unit_tests.yaml | 6 +++++- .github/workflows/prebuild.yaml | 1 + .github/workflows/python.yaml | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/capgen_unit_tests.yaml b/.github/workflows/capgen_unit_tests.yaml index 374681f1..4b8598f0 100644 --- a/.github/workflows/capgen_unit_tests.yaml +++ b/.github/workflows/capgen_unit_tests.yaml @@ -3,7 +3,11 @@ name: Capgen Unit Tests on: workflow_dispatch: pull_request: - branches: [develop, main] + branches: [develop] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: unit_tests: diff --git a/.github/workflows/prebuild.yaml b/.github/workflows/prebuild.yaml index 43eda35c..6ef3841c 100644 --- a/.github/workflows/prebuild.yaml +++ b/.github/workflows/prebuild.yaml @@ -2,6 +2,7 @@ name: ccpp-prebuild on: pull_request: + branches: [develop] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index fc12a3d1..b8508f2a 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -3,7 +3,11 @@ name: Python package on: workflow_dispatch: pull_request: - branches: [develop, main] + branches: [develop] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: build: From da63617e21184b4ab830bc37cc124b499b2a4bd0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 11:22:41 -0700 Subject: [PATCH 3/7] Turn off all tests except Codee formatting --- .github/workflows/{ => TMP_OFF}/capgen_unit_tests.yaml | 0 .github/workflows/{ => TMP_OFF}/prebuild.yaml | 0 .github/workflows/{ => TMP_OFF}/python.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ => TMP_OFF}/capgen_unit_tests.yaml (100%) rename .github/workflows/{ => TMP_OFF}/prebuild.yaml (100%) rename .github/workflows/{ => TMP_OFF}/python.yaml (100%) diff --git a/.github/workflows/capgen_unit_tests.yaml b/.github/workflows/TMP_OFF/capgen_unit_tests.yaml similarity index 100% rename from .github/workflows/capgen_unit_tests.yaml rename to .github/workflows/TMP_OFF/capgen_unit_tests.yaml diff --git a/.github/workflows/prebuild.yaml b/.github/workflows/TMP_OFF/prebuild.yaml similarity index 100% rename from .github/workflows/prebuild.yaml rename to .github/workflows/TMP_OFF/prebuild.yaml diff --git a/.github/workflows/python.yaml b/.github/workflows/TMP_OFF/python.yaml similarity index 100% rename from .github/workflows/python.yaml rename to .github/workflows/TMP_OFF/python.yaml From adea079b28793f7c13a7c657a99ee1fe2f315a89 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 11:07:06 -0700 Subject: [PATCH 4/7] Add .github/workflows/fortran-formatting.yaml --- .github/workflows/fortran-formatting.yaml | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/fortran-formatting.yaml diff --git a/.github/workflows/fortran-formatting.yaml b/.github/workflows/fortran-formatting.yaml new file mode 100644 index 00000000..577649c7 --- /dev/null +++ b/.github/workflows/fortran-formatting.yaml @@ -0,0 +1,73 @@ +name: Codee format Fortran + +on: + pull_request: + branches: [develop] + types: [opened, synchronize, labeled, unlabeled] + +env: + CODEE_VERSION: 2025.4.5 + +permissions: + contents: write + pull-requests: write + +jobs: + format: + name: Check and fix Fortran formatting + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get modified Fortran files + #id: modified-files + run: | + git remote -v show + git fetch origin ${{ github.base_ref }} + MODIFIED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }}...HEAD -- '*.f90' '*.F90' '*.f' '*.F') + echo "MODIFIED_FILES=${MODIFIED_FILES}" >> ${GITHUB_ENV} + + - name: Install Codee + if: env.MODIFIED_FILES != '' + run: | + echo "Installing Codee ${CODEE_VERSION} ..." + wget https://codee.com/release/codee-${CODEE_VERSION}-linux-x86_64.tar.gz + tar -xf codee-${CODEE_VERSION}-linux-x86_64.tar.gz + + - name: Run `codee format` on modified files + if: env.MODIFIED_FILES != '' + run: | + export PATH="${PWD}/codee-${CODEE_VERSION}-linux-x86_64/bin:${PATH}" + codee format --accept-eula --verbose ${MODIFIED_FILES} + REFORMATTED_FILES=$(git diff --name-only --diff-filter=d) + echo "REFORMATTED_FILES=${REFORMATTED_FILES}" >> ${GITHUB_ENV} + + - name: Fail if there are uncommitted changes and the `fix-fortran-format` label is not present + if: ${{ env.REFORMATTED_FILES != '' && !contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} + run: | + echo "Formatting issues detected. Run 'codee format' locally or attach label 'fix-fortran-format' to this PR." + exit 1 + +# - name: Fix formatting if label 'fix-fortran-format; is present +# if: ${{ env.MODIFIED_FILES != '' && contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} +# run: | +# export PATH="${PWD}/codee-${CODEE_VERSION}-linux-x86_64/bin:${PATH}" +# git codee-format --diff origin/${{ github.base_ref }} HEAD +# git diff + + - name: Commit changes if the `fix-fortran-format` label is not present + if: ${{ env.REFORMATTED_FILES != '' && contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} + run: | + # Push with the github-actions user. More information at: + # https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -b ${{ github.head_ref }} + git add ${REFORMATTED_FILES} + git commit -m "Apply codee format formatting fixes" + echo "DH DEBUG: 'git push --set-upstream origin ${{ github.head_ref }}'" + git push --set-upstream origin ${{ github.head_ref }} From 9a23af4cf0bb19bc2eab1998a210627827f2f1e0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 21:05:45 +0000 Subject: [PATCH 5/7] Apply codee format formatting fixes --- src/ccpp_hash_table.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ccpp_hash_table.F90 b/src/ccpp_hash_table.F90 index af268450..6e08e8b2 100644 --- a/src/ccpp_hash_table.F90 +++ b/src/ccpp_hash_table.F90 @@ -1,7 +1,7 @@ !!XXgoldyXX: To do, statistics output module ccpp_hash_table -! Modify this file ... + ! Modify this file ... use ccpp_hashable, only: ccpp_hashable_t From 62486eed5292ce7be93c032830aa31df7ef2d5c3 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 14:06:59 -0700 Subject: [PATCH 6/7] Rogue reformatting of src/ccpp_hash_table.F90 --- .github/workflows/fortran-formatting.yaml | 58 +++++++++++++---------- src/ccpp_hash_table.F90 | 2 +- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/.github/workflows/fortran-formatting.yaml b/.github/workflows/fortran-formatting.yaml index 577649c7..bb0b568b 100644 --- a/.github/workflows/fortran-formatting.yaml +++ b/.github/workflows/fortran-formatting.yaml @@ -8,9 +8,11 @@ on: env: CODEE_VERSION: 2025.4.5 -permissions: - contents: write - pull-requests: write +# Only needed when fixing formatting automatically, but this only +# works for pull requests from the same repo, not from a fork +#permissions: +# contents: write +# pull-requests: write jobs: format: @@ -24,7 +26,6 @@ jobs: fetch-depth: 0 - name: Get modified Fortran files - #id: modified-files run: | git remote -v show git fetch origin ${{ github.base_ref }} @@ -46,28 +47,33 @@ jobs: REFORMATTED_FILES=$(git diff --name-only --diff-filter=d) echo "REFORMATTED_FILES=${REFORMATTED_FILES}" >> ${GITHUB_ENV} - - name: Fail if there are uncommitted changes and the `fix-fortran-format` label is not present - if: ${{ env.REFORMATTED_FILES != '' && !contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} + - name: Fail if there are uncommitted changes + if: ${{ env.REFORMATTED_FILES != '' }} run: | - echo "Formatting issues detected. Run 'codee format' locally or attach label 'fix-fortran-format' to this PR." + echo "Formatting issues detected. Run 'codee format' locally or apply the following diff manually:" + git diff exit 1 -# - name: Fix formatting if label 'fix-fortran-format; is present -# if: ${{ env.MODIFIED_FILES != '' && contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} -# run: | -# export PATH="${PWD}/codee-${CODEE_VERSION}-linux-x86_64/bin:${PATH}" -# git codee-format --diff origin/${{ github.base_ref }} HEAD -# git diff - - - name: Commit changes if the `fix-fortran-format` label is not present - if: ${{ env.REFORMATTED_FILES != '' && contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} - run: | - # Push with the github-actions user. More information at: - # https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git checkout -b ${{ github.head_ref }} - git add ${REFORMATTED_FILES} - git commit -m "Apply codee format formatting fixes" - echo "DH DEBUG: 'git push --set-upstream origin ${{ github.head_ref }}'" - git push --set-upstream origin ${{ github.head_ref }} + #- name: Fail if there are uncommitted changes and the `fix-fortran-format` label is not present + # if: ${{ env.REFORMATTED_FILES != '' && !contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} + # run: | + # echo "Formatting issues detected. Run 'codee format' locally or attach label 'fix-fortran-format' to this PR." + # exit 1 + # + # This doesn't work if the pull request comes from a fork ... + #- name: Commit changes if the `fix-fortran-format` label is not present + # if: ${{ env.REFORMATTED_FILES != '' && contains(github.event.pull_request.labels.*.name, 'fix-fortran-format') }} + # run: | + # # Push with the github-actions user. More information at: + # # https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token + # git config user.name "github-actions[bot]" + # git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + # git checkout -b ${{ github.head_ref }} + # git add ${REFORMATTED_FILES} + # git commit -m "Apply codee format formatting fixes" + # + # git remote add realsource ${{ github.event.pull_request.head.repo.clone_url }} + # git remote -v show + # git push --set-upstream source ${{ github.head_ref }} + # # If PR comes from the target repository (origin), can do: + # # git push --set-upstream origin ${{ github.head_ref }} diff --git a/src/ccpp_hash_table.F90 b/src/ccpp_hash_table.F90 index 6e08e8b2..af268450 100644 --- a/src/ccpp_hash_table.F90 +++ b/src/ccpp_hash_table.F90 @@ -1,7 +1,7 @@ !!XXgoldyXX: To do, statistics output module ccpp_hash_table - ! Modify this file ... +! Modify this file ... use ccpp_hashable, only: ccpp_hashable_t From 62146643ffe12b216c10e8f25f2c4cf65b1c54b0 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Thu, 22 Jan 2026 14:50:22 -0700 Subject: [PATCH 7/7] Re-enable other GitHub workflows --- .github/workflows/{TMP_OFF => }/capgen_unit_tests.yaml | 0 .github/workflows/{TMP_OFF => }/prebuild.yaml | 0 .github/workflows/{TMP_OFF => }/python.yaml | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{TMP_OFF => }/capgen_unit_tests.yaml (100%) rename .github/workflows/{TMP_OFF => }/prebuild.yaml (100%) rename .github/workflows/{TMP_OFF => }/python.yaml (100%) diff --git a/.github/workflows/TMP_OFF/capgen_unit_tests.yaml b/.github/workflows/capgen_unit_tests.yaml similarity index 100% rename from .github/workflows/TMP_OFF/capgen_unit_tests.yaml rename to .github/workflows/capgen_unit_tests.yaml diff --git a/.github/workflows/TMP_OFF/prebuild.yaml b/.github/workflows/prebuild.yaml similarity index 100% rename from .github/workflows/TMP_OFF/prebuild.yaml rename to .github/workflows/prebuild.yaml diff --git a/.github/workflows/TMP_OFF/python.yaml b/.github/workflows/python.yaml similarity index 100% rename from .github/workflows/TMP_OFF/python.yaml rename to .github/workflows/python.yaml