ci: skip dev image build on tags, wait for in-progress CI runs, improve quality error output (#171)

- Skip the dev image build job on tag pushes — it was wasted work since
  quality and tests are already skipped on tags
- Remove the unnecessary `needs: build` from verify-prior-run; it ran
  independently of the dev image anyway
- Make verify-prior-run poll (30s interval, 15 min max) so tagging
  immediately after a push to main waits for the CI run to finish rather
  than failing instantly
- Replace the yes/no outcomes string in "Assert all checks passed" with
  per-step ::error:: annotations so GitHub highlights exactly which
  quality check failed
This commit is contained in:
2026-07-03 14:28:01 +02:00
committed by GitHub
parent d37136be93
commit 5ea7a636b8
+46 -12
View File
@@ -21,6 +21,7 @@ jobs:
name: Build Dev Image name: Build Dev Image
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 15 timeout-minutes: 15
if: "!startsWith(github.ref, 'refs/tags/')"
permissions: permissions:
contents: read contents: read
steps: steps:
@@ -97,8 +98,20 @@ jobs:
- name: Assert all checks passed - name: Assert all checks passed
if: always() if: always()
run: | run: |
outcomes="${{ steps.twig_lint.outcome }} ${{ steps.cs.outcome }} ${{ steps.twig_cs.outcome }} ${{ steps.phpstan.outcome }} ${{ steps.rector.outcome }}" failed=0
if echo "$outcomes" | grep -q "failure"; then exit 1; fi check() {
local name="$1" outcome="$2"
if [[ "$outcome" == "failure" ]]; then
echo "::error::$name failed"
failed=1
fi
}
check "Twig Lint" "${{ steps.twig_lint.outcome }}"
check "Coding Style" "${{ steps.cs.outcome }}"
check "Twig Coding Style" "${{ steps.twig_cs.outcome }}"
check "PHPStan" "${{ steps.phpstan.outcome }}"
check "Rector" "${{ steps.rector.outcome }}"
exit $failed
tests: tests:
name: Tests name: Tests
@@ -148,23 +161,44 @@ jobs:
verify-prior-run: verify-prior-run:
name: Verify Prior CI Run name: Verify Prior CI Run
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build timeout-minutes: 20
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
permissions: permissions:
actions: read actions: read
steps: steps:
- name: Check for successful CI run on this commit - name: Wait for and verify successful CI run on this commit
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: | run: |
count=$(gh api \ max_attempts=30
"repos/${{ github.repository }}/actions/workflows/ci.yml/runs?head_sha=${{ github.sha }}&status=success&per_page=5" \ attempt=0
--jq "[.workflow_runs[] | select(.id != ${{ github.run_id }})] | length") while [[ $attempt -lt $max_attempts ]]; do
if [[ "$count" -eq 0 ]]; then attempt=$((attempt + 1))
echo "::error::No prior successful CI run found for ${{ github.sha }}. Only tag commits that have passed CI on main."
exit 1 success_count=$(gh api \
fi "repos/${{ github.repository }}/actions/workflows/ci.yml/runs?head_sha=${{ github.sha }}&status=success&per_page=5" \
echo "Found $count prior successful CI run(s) for this commit." --jq "[.workflow_runs[] | select(.id != ${{ github.run_id }})] | length")
if [[ "$success_count" -gt 0 ]]; then
echo "Found $success_count prior successful CI run(s) for ${{ github.sha }}."
exit 0
fi
in_progress_count=$(gh api \
"repos/${{ github.repository }}/actions/workflows/ci.yml/runs?head_sha=${{ github.sha }}&per_page=10" \
--jq "[.workflow_runs[] | select(.id != ${{ github.run_id }}) | select(.status == \"in_progress\" or .status == \"queued\" or .status == \"waiting\" or .status == \"requested\" or .status == \"pending\")] | length")
if [[ "$in_progress_count" -gt 0 ]]; then
echo "CI still in progress (attempt $attempt/$max_attempts), waiting 30s..."
sleep 30
else
echo "::error::No prior successful CI run found for ${{ github.sha }}. Only tag commits that have passed CI on main."
exit 1
fi
done
echo "::error::Timed out waiting for CI run to complete for ${{ github.sha }}."
exit 1
build-deploy: build-deploy:
name: Build and Deploy name: Build and Deploy