Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created July 7, 2024 19:26
Show Gist options
  • Save KyMidd/51eb3d07fa2629970e522eff2693ee4d to your computer and use it in GitHub Desktop.
Save KyMidd/51eb3d07fa2629970e522eff2693ee4d to your computer and use it in GitHub Desktop.
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