Skip to content

Commit

Permalink
fixing dependabot automerge
Browse files Browse the repository at this point in the history
  • Loading branch information
yaleman committed May 26, 2024
1 parent 41b81d0 commit a8d71c0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions scripts/dependabot_automerge_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Specify the PR URL"
exit 1
fi

PR_URL="$1"

# sets the upstream metadata for `gh pr status`
gh pr checkout "$PR_URL"


# are we good?
echo "Checking Conclusions"
CONCLUSIONS="$(gh pr status --json statusCheckRollup | jq '.currentBranch | .[] | .[] | select(.conclusion != "SUCCESS") | select(.conclusion != "NEUTRAL")| {status: .status, workfFlowName: .workFlowName, conclusion: .conclusion}')"



if [ "$(echo "${CONCLUSIONS}" | wc -l)" -eq 0 ]; then
gh pr review --approve "$PR_URL"
else
echo "Already running or failed: ${CONCLUSIONS}";
fi

if [ "${APPROVED}" != "APPROVED" ]; then
echo "PR isn't approved!"
exit 0
fi

# check approval
echo "Checking if already approved...."
APPROVED="$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)"

0 comments on commit a8d71c0

Please sign in to comment.