mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-23 00:05:09 +00:00
Introduces a reusable workflow that waits until the 'Check' workflow has successfully passed on the current commit. Also adds 'release-trigger', which runs on push to main and calls this reusable workflow before allowing semantic-release to continue. - Prevents race conditions between quality checks and release - No external dependencies (uses native GitHub CLI) - Improves reliability and control of CI/CD sequencing
52 lines
1.4 KiB
YAML
52 lines
1.4 KiB
YAML
name: Wait for Check Workflow
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
sha:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
GH_TOKEN:
|
|
required: true
|
|
|
|
jobs:
|
|
wait-for-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Wait for Check workflow to succeed
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
SHA: ${{ inputs.sha }}
|
|
run: |
|
|
echo "🔁 Waiting for 'Check' workflow to succeed on commit $SHA..."
|
|
|
|
max_attempts=30
|
|
attempt=1
|
|
interval=10
|
|
success=false
|
|
|
|
while [ $attempt -le $max_attempts ]; do
|
|
echo "Attempt $attempt..."
|
|
status=$(gh run list --workflow "Check" --limit 1 --json status,conclusion,headSha -q \
|
|
'map(select(.headSha=="'"$SHA"'")) | .[0] | "\(.status)-\(.conclusion)"')
|
|
|
|
if [[ "$status" == "completed-success" ]]; then
|
|
echo "✅ Check passed."
|
|
success=true
|
|
break
|
|
elif [[ "$status" == completed-* ]]; then
|
|
echo "❌ Check completed but failed."
|
|
exit 1
|
|
else
|
|
echo "⏳ Still in progress..."
|
|
sleep $interval
|
|
((attempt++))
|
|
fi
|
|
done
|
|
|
|
if [[ "$success" == false ]]; then
|
|
echo "❌ Timeout: Check workflow did not complete in time."
|
|
exit 1
|
|
fi
|