Skip to content

Commit 1508410

Browse files
committed
poc
1 parent 69bd16e commit 1508410

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/pipeleak.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Wait for Sibling Runs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
wait-for-siblings:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Wait until all runs for this commit finish
15+
id: wait
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
SHA: ${{ github.sha }}
19+
REPO: ${{ github.repository }}
20+
RUN_ID: ${{ github.run_id }}
21+
run: |
22+
echo "Checking for runs triggered by commit $SHA in $REPO"
23+
24+
while true; do
25+
runs=$(gh api repos/$REPO/actions/runs \
26+
--paginate \
27+
--jq ".workflow_runs[] | select(.head_sha==\"$SHA\" and .id != $RUN_ID) | {id: .id, name: .name, status: .status, conclusion: .conclusion}")
28+
29+
echo "Current runs:"
30+
echo "$runs" | jq .
31+
32+
in_progress=$(echo "$runs" | jq -r 'select(.status != "completed") | .id' | wc -l)
33+
34+
if [ "$in_progress" -eq 0 ]; then
35+
echo "✅ All runs are completed."
36+
break
37+
fi
38+
39+
echo "⏳ Still waiting for $in_progress run(s) to finish..."
40+
sleep 30
41+
done
42+
43+
# Extract just the IDs into a space-separated string
44+
run_ids=$(echo "$runs" | jq -r '.id' | tr '\n' ' ')
45+
echo "Runs completed: $run_ids"
46+
47+
# Expose IDs as output
48+
echo "run_ids=$run_ids" >> $GITHUB_OUTPUT
49+
50+
- name: Run custom command
51+
run: |
52+
echo "🚀 All workflows finished. Run IDs:"
53+
echo "${{ steps.wait.outputs.run_ids }}"

0 commit comments

Comments
 (0)