File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,3 +102,43 @@ jobs:
102102
103103 - name : Verify log-in
104104 run : doctl compute region list
105+
106+ ci_success :
107+ runs-on : ubuntu-latest
108+ needs :
109+ - lint
110+ - package_check
111+ - test
112+ - test_no_auth
113+ - test_custom_version_linux_and_mac
114+ - test_custom_version_windows
115+ if : always()
116+
117+ steps :
118+ - name : Validate job results
119+ run : |
120+ echo "Checking workflow results..."
121+
122+ NEEDS_JSON='${{ toJson(needs) }}'
123+
124+ # Detect fork PR
125+ if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then
126+ echo "Fork PR detected → checking only mandatory jobs"
127+ REQUIRED_JOBS=("lint" "package_check" "test_no_auth")
128+ else
129+ echo "Internal PR or push → checking all jobs"
130+ REQUIRED_JOBS=("lint" "package_check" "test" "test_no_auth" "test_custom_version_linux_and_mac" "test_custom_version_windows")
131+ fi
132+
133+ for job in "${REQUIRED_JOBS[@]}"; do
134+ result=$(echo "$NEEDS_JSON" | jq -r ".\"$job\".result")
135+
136+ echo "$job → $result"
137+
138+ if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
139+ echo "$job failed"
140+ exit 1
141+ fi
142+ done
143+
144+ echo "All required jobs passed."
You can’t perform that action at this time.
0 commit comments