Skip to content

Commit

Permalink
Automatically open PR after make update-helm-plugin-repo
Browse files Browse the repository at this point in the history
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
  • Loading branch information
Danil-Grigorev committed Feb 20, 2024
1 parent c89c2d7 commit d309c96
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions hack/publish-index-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo "Usage: $0 RELEASE_TAG"
exit 1
fi

RELEASE_TAG="$1"
BRANCH_NAME="index-${RELEASE_TAG}"
COMMIT_MESSAGE="This PR updates index.yaml for ${RELEASE_TAG}. Automatically generated by make update-helm-repo."
PR_TITLE="🌱 Update helm chart index.yaml to ${RELEASE_TAG}"
PR_DESCRIPTION="**What this PR does / why we need it:**\n\nThis PR updates index.yaml for ${RELEASE_TAG}. Automatically generated by \`make update-helm-repo\`."

# Checkout index-${RELEASE_TAG} branch
git checkout -b "${BRANCH_NAME}"

# Add files to commit
git add plugins/clusterctl-operator.yaml index.yaml

# Commit changes with appropriate message
git commit -m "${COMMIT_MESSAGE}"

# Push changes to origin
git push origin "${BRANCH_NAME}"

if ! command -v gh &> /dev/null
then
echo "GitHub CLI (gh) is not installed."
echo "Please open a pull request with the following details:"
echo "Title: $PR_TITLE"
echo -e "Description: \n$PR_DESCRIPTION"
exit 0
fi

# Open a PR with title and description
gh pr create --title "${PR_TITLE}" --body "${PR_DESCRIPTION}"

0 comments on commit d309c96

Please sign in to comment.