Skip to content

Commit 8f5a407

Browse files
committed
Actions: Revert hindcast run determination to original code
1 parent 9f12b4e commit 8f5a407

1 file changed

Lines changed: 4 additions & 21 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,47 +39,30 @@ jobs:
3939
fi
4040
4141
42-
# Hindcast tests only run on pull requests. On push events,
43-
# dorny/paths-filter compares against the previous branch HEAD
44-
# (not the target branch), which causes false positives.
42+
# This job decides if the hindcast test suite should run.
4543
check-changes:
4644
runs-on: ubuntu-latest
4745
outputs:
4846
wave_io_hindcast_changed: ${{ steps.changes.outputs.wave_io_hindcast }}
4947
should-run-hindcast: ${{ steps.hindcast-logic.outputs.should-run-hindcast }}
5048
steps:
5149
- name: Checkout code
52-
uses: actions/checkout@v6
50+
uses: actions/checkout@v4
5351

5452
- name: Check for changes in wave/io/hindcast
5553
id: changes
56-
if: github.event_name == 'pull_request'
5754
uses: dorny/paths-filter@v3
5855
with:
5956
filters: |
6057
wave_io_hindcast:
6158
- 'mhkit/wave/io/hindcast/**'
6259
- 'mhkit/tests/wave/io/hindcast/**'
6360
64-
- name: Determine if hindcast tests should run
65-
id: hindcast-logic
61+
- id: hindcast-logic
6662
run: |
67-
# Case 1: A push (merge) to a primary branch. Always run.
68-
if [[ "${{ github.event_name }}" == "push" && ("${{ github.ref_name }}" == "main" || "${{ github.ref_name }}" == "develop") ]]; then
69-
echo "Push to main or develop detected. Forcing hindcast tests to run."
63+
if [[ "${{ github.event.pull_request.base.ref }}" == "main" || "${{ steps.changes.outputs.wave_io_hindcast }}" == "true" ]]; then
7064
echo "should-run-hindcast=true" >> "$GITHUB_OUTPUT"
71-
# Case 2: A pull request. Use the original logic.
72-
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
73-
if [[ "${{ github.base_ref }}" == "main" || "${{ steps.changes.outputs.wave_io_hindcast }}" == "true" ]]; then
74-
echo "PR to main or with hindcast changes detected. Running hindcast tests."
75-
echo "should-run-hindcast=true" >> "$GITHUB_OUTPUT"
76-
else
77-
echo "PR does not require hindcast tests."
78-
echo "should-run-hindcast=false" >> "$GITHUB_OUTPUT"
79-
fi
80-
# Default case: Don't run tests.
8165
else
82-
echo "Event is not a push to a primary branch or a pull request. Skipping hindcast tests."
8366
echo "should-run-hindcast=false" >> "$GITHUB_OUTPUT"
8467
fi
8568

0 commit comments

Comments
 (0)