File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Get the API URL as an argument
4+ if [ -z " $1 " ]; then
5+ echo " Usage: $0 <API_URL>"
6+ exit 1
7+ fi
8+ API_URL=" $1 "
9+
10+ # Get the GitHub token from an environment variable
11+ GITHUB_TOKEN=" ${GITHUB_TOKEN:- } "
12+ if [ -z " $GITHUB_TOKEN " ]; then
13+ echo " Error: GITHUB_TOKEN environment variable not set."
14+ exit 1
15+ fi
16+
17+ # Function to check the merge status
18+ check_pr_status () {
19+ PR_DATA=$( curl -s -H " Authorization: token $GITHUB_TOKEN " " $API_URL " )
20+ if echo " $PR_DATA " | grep -q ' "merged": true' ; then
21+ echo " Pull request is merged."
22+ return 0
23+ else
24+ echo " Pull request is not merged. Checking again in 60 seconds..."
25+ sleep 60
26+ return 1
27+ fi
28+ }
29+
30+ # Keep checking until the PR is merged
31+ while check_pr_status; do
32+ :
33+ done
You can’t perform that action at this time.
0 commit comments