Merge pull request #197 from cloud-neutral-toolkit/codex/add-iaas-ready-check-workflow
Make Check IaaS Ready workflow configurable
This commit is contained in:
commit
d246ff55cc
53
.github/workflows/check-iaas-ready.yaml
vendored
Normal file
53
.github/workflows/check-iaas-ready.yaml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Check IaaS Ready
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
workflows:
|
||||
description: "Comma-separated workflow filenames to check"
|
||||
required: true
|
||||
type: string
|
||||
branch:
|
||||
description: "Branch to check"
|
||||
default: main
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check workflows status
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
WORKFLOWS: ${{ inputs.workflows }}
|
||||
BRANCH: ${{ inputs.branch }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
IFS=',' read -ra WF_LIST <<< "$WORKFLOWS"
|
||||
|
||||
for WF in "${WF_LIST[@]}"; do
|
||||
WF=$(echo "$WF" | xargs)
|
||||
echo "🔍 Checking workflow: $WF"
|
||||
|
||||
RUN=$(gh api \
|
||||
repos/$REPO/actions/workflows/$WF/runs \
|
||||
-F branch="$BRANCH" \
|
||||
-F per_page=1 \
|
||||
--jq '.workflow_runs[0]')
|
||||
|
||||
if [ "$RUN" = "null" ]; then
|
||||
echo "❌ No runs found for $WF"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATUS=$(echo "$RUN" | jq -r '.conclusion')
|
||||
|
||||
if [ "$STATUS" != "success" ]; then
|
||||
echo "❌ $WF latest run is not successful: $STATUS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ $WF is ready"
|
||||
done
|
||||
Loading…
Reference in New Issue
Block a user