-
-
Save KyMidd/51eb3d07fa2629970e522eff2693ee4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update_pr_title() { | |
echo "🟢 New PR title will be: $PR_TITLE" | |
unset CURL | |
CURL=$(curl -s \ | |
-X PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/$GH_ORG/$GH_REPO/pulls/$PULL_REQUEST_NUMBER \ | |
-d "{\"title\":\"$PR_TITLE\"}" 2>&1 || true) | |
if [[ $(echo "$CURL" | jq -r '.title') == $PR_TITLE ]]; then | |
echo "🟢 Successfully updated PR title" | |
exit_if_not_local 0 | |
else | |
echo "🔴 Something bad happened updating the PR title, please investigate response:" | |
echo "$CURL" | |
exit_if_not_local 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment