Skip to content

Commit 6092e60

Browse files
authored
Merge pull request #33 from ulysses4ever/update-ci-automation-fix
fix update-CI automation to not spam with "no jobs run" failure [skip ci]
2 parents 2ced5fd + 23c55af commit 6092e60

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

.github/workflows/update-haskell-ci-on-tested-with-pr.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,44 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21+
gate:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
eligible: ${{ steps.gate.outputs.eligible }}
25+
steps:
26+
- name: Decide eligibility (title starts with tested-with, same-repo PR)
27+
id: gate
28+
shell: bash
29+
run: |
30+
set -euo pipefail
31+
# Read and sanitize the PR title (handles quotes)
32+
title=${{ toJSON(github.event.pull_request.title) }}
33+
title=${title#\"}; title=${title%\"}
34+
head_repo="${{ github.event.pull_request.head.repo.full_name }}"
35+
base_repo="${{ github.repository }}"
36+
37+
title_ok=false
38+
if printf '%s' "$title" | grep -qiE '^tested-with'; then
39+
title_ok=true
40+
fi
41+
42+
same_repo=false
43+
if [ "$head_repo" = "$base_repo" ]; then
44+
same_repo=true
45+
fi
46+
47+
eligible=false
48+
if [ "$title_ok" = true ] && [ "$same_repo" = true ]; then
49+
eligible=true
50+
fi
51+
52+
echo "Eligibility: title_ok=$title_ok, same_repo=$same_repo, eligible=$eligible"
53+
echo "eligible=$eligible" >> "$GITHUB_OUTPUT"
54+
55+
2156
update-ci:
22-
# Require: title starts with "tested-with" (case-insensitive)
23-
# and PR originates from the same repository (safe to push back)
24-
if: >
25-
startsWith(toLower(github.event.pull_request.title), 'tested-with') &&
26-
github.event.pull_request.head.repo.full_name == github.repository
57+
needs: gate
58+
if: needs.gate.outputs.eligible == 'true'
2759
runs-on: ubuntu-latest
2860

2961
steps:

0 commit comments

Comments
 (0)