Skip to content

Commit 492e444

Browse files
authored
Enhance execution control in BET-2026 workflow
Added conditional checks for RUN_PIPELINE variable to control execution flow and prevent automatic execution on push events. Updated comments for clarity.
1 parent a11d9e1 commit 492e444

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

.github/workflows/bet-2026-report.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,26 @@ jobs:
2626
RUN_PIPELINE: ${{ vars.RUN_PIPELINE }}
2727

2828
steps:
29-
# Checkout repository
29+
# Checkout repository (always required)
3030
- name: Checkout repository
3131
uses: actions/checkout@v3
3232

33+
# Early exit for push when RUN_PIPELINE != true
34+
- name: Skip push event if RUN_PIPELINE is false
35+
if: ${{ github.event_name == 'push' && env.RUN_PIPELINE != 'true' }}
36+
run: |
37+
echo "Automatic execution is disabled (RUN_PIPELINE=false). Exiting."
38+
exit 0
39+
3340
# Pull Docker image for consistent environment
3441
- name: Pull BET-2026 Docker image
42+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
3543
run: docker pull ghcr.io/pacificcommunity/bet-2026:v1.2
3644

3745
# Run the BET-2026 pipeline
3846
- name: Run BET-2026 pipeline
47+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
3948
run: |
40-
# Automatic execution control
41-
if [ "${RUN_PIPELINE}" != "true" ] && [ "${{ github.event_name }}" == "push" ]; then
42-
echo "Automatic execution is disabled. Exiting."
43-
exit 0
44-
fi
45-
46-
# Execute pipeline according to selected mode
4749
if [ "${{ github.event.inputs.run_mode }}" == "plots_only" ]; then
4850
make docker-plot_sens
4951
make docker-plot_grid
@@ -57,6 +59,7 @@ jobs:
5759
5860
# Prepare release directory
5961
- name: Prepare release directory
62+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
6063
run: |
6164
mkdir -p public
6265
cp report/bet-2026.pdf public/ || true
@@ -65,22 +68,22 @@ jobs:
6568
6669
# Deploy outputs to GitHub Pages
6770
- name: Deploy to GitHub Pages
71+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
6872
uses: peaceiris/actions-gh-pages@v3
6973
with:
7074
github_token: ${{ secrets.GITHUB_TOKEN }}
7175
publish_dir: ./public
7276

7377
# Create a unique version tag
7478
- name: Create version tag
79+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
7580
id: tag
7681
run: |
7782
DATE=$(date +'%Y%m%d')
7883
BASE_TAG="v${DATE}"
7984
80-
# Fetch remote tags to avoid conflicts
8185
git fetch --tags
8286
83-
# Count all local + remote tags starting with BASE_TAG
8487
EXISTING_COUNT=$(git tag -l "${BASE_TAG}*" | wc -l)
8588
8689
if [ "$EXISTING_COUNT" -eq 0 ]; then
@@ -93,8 +96,9 @@ jobs:
9396
git tag "$TAG"
9497
git push origin "$TAG"
9598
96-
# Create GitHub Release and attach PDF + HTML outputs
99+
# Create GitHub Release
97100
- name: Create GitHub Release
101+
if: ${{ github.event_name == 'workflow_dispatch' || env.RUN_PIPELINE == 'true' }}
98102
uses: softprops/action-gh-release@v1
99103
with:
100104
tag_name: ${{ steps.tag.outputs.tag }}
@@ -112,5 +116,3 @@ jobs:
112116
report/bet-2026.pdf
113117
plot/plots_sens.html
114118
plot/plots_grid.html
115-
116-

0 commit comments

Comments
 (0)