Skip to content

Commit d309c96

Browse files
Automatically open PR after make update-helm-plugin-repo
Signed-off-by: Danil Grigorev <[email protected]>
1 parent c89c2d7 commit d309c96

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

hack/publish-index-changes.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
if [ $# -ne 1 ]; then
4+
echo "Usage: $0 RELEASE_TAG"
5+
exit 1
6+
fi
7+
8+
RELEASE_TAG="$1"
9+
BRANCH_NAME="index-${RELEASE_TAG}"
10+
COMMIT_MESSAGE="This PR updates index.yaml for ${RELEASE_TAG}. Automatically generated by make update-helm-repo."
11+
PR_TITLE="🌱 Update helm chart index.yaml to ${RELEASE_TAG}"
12+
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\`."
13+
14+
# Checkout index-${RELEASE_TAG} branch
15+
git checkout -b "${BRANCH_NAME}"
16+
17+
# Add files to commit
18+
git add plugins/clusterctl-operator.yaml index.yaml
19+
20+
# Commit changes with appropriate message
21+
git commit -m "${COMMIT_MESSAGE}"
22+
23+
# Push changes to origin
24+
git push origin "${BRANCH_NAME}"
25+
26+
if ! command -v gh &> /dev/null
27+
then
28+
echo "GitHub CLI (gh) is not installed."
29+
echo "Please open a pull request with the following details:"
30+
echo "Title: $PR_TITLE"
31+
echo -e "Description: \n$PR_DESCRIPTION"
32+
exit 0
33+
fi
34+
35+
# Open a PR with title and description
36+
gh pr create --title "${PR_TITLE}" --body "${PR_DESCRIPTION}"

0 commit comments

Comments
 (0)