Skip to content

Commit 0a5b9fc

Browse files
committed
chore(build): Add preflight to check job and workflow cancel on failure
1 parent ef3dfb9 commit 0a5b9fc

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ jobs:
4545
preflight:
4646
runs-on: ubuntu-24.04
4747
container:
48-
image: ghcr.io/jdx/mise:latest
48+
image: ghcr.io/ansible/ext-builder:latest
4949
env:
5050
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5151
MISE_TRUSTED_CONFIG_PATHS: /
52+
SKIP_PODMAN: 1
53+
SKIP_DOCKER: 1
5254
continue-on-error: false
5355
outputs:
5456
commit_context: ${{ steps.extract_context.outputs.context }}
@@ -69,6 +71,7 @@ jobs:
6971
mise cfg
7072
mise exec -- which python3
7173
mise exec -- printenv NODE_OPTIONS || true
74+
mise exec -- npm config set engine-strict false
7275
task setup
7376
7477
- name: Extract commit context from conventional commit
@@ -98,10 +101,10 @@ jobs:
98101
echo "context=" >> "$GITHUB_OUTPUT"
99102
fi
100103
101-
- name: task build
102-
timeout-minutes: 2 # expected under 1 minutes
104+
- name: task package
105+
timeout-minutes: 3
103106
run: |
104-
task build
107+
task package
105108
106109
- name: Run context-specific command
107110
if: >-
@@ -120,10 +123,13 @@ jobs:
120123
run: |
121124
task docs
122125
123-
- name: task package
124-
timeout-minutes: 2
126+
- name: Cancel workflow on preflight failure
127+
if: failure()
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125130
run: |
126-
task package
131+
echo "Preflight failed - cancelling workflow"
132+
gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel -X POST
127133
128134
build:
129135
name: ${{ matrix.name }}
@@ -472,6 +478,7 @@ jobs:
472478
check: # This job does nothing and is only used for the branch protection
473479
needs:
474480
- build
481+
- preflight
475482

476483
permissions:
477484
checks: read # codecov

0 commit comments

Comments
 (0)