diff --git a/scripts/create_automated_m2k_kfunc_pr.sh b/scripts/create_automated_m2k_kfunc_pr.sh index 82aa86ff..5e0b272c 100644 --- a/scripts/create_automated_m2k_kfunc_pr.sh +++ b/scripts/create_automated_m2k_kfunc_pr.sh @@ -11,10 +11,10 @@ INPUT_VALUES_FILEPATH=$8 git config --global user.email "${USER_EMAIL}" git config --global user.name "${USER_NAME}" gh repo clone "${WF_CONFIG_REPO}" config-repo -cd config-repo +cd config-repo || exit git switch -c "${WORKFLOW_ID}"-autopr-"${RANDOM}" -./../hack/bump_chart_version.sh ${WORKFLOW_ID} --bump-tag-version +./../hack/bump_chart_version.sh "${WORKFLOW_ID}" --bump-tag-version cp "${INPUT_VALUES_FILEPATH}" charts/move2kube/values.yaml @@ -22,13 +22,13 @@ mkdir -p charts/"${WORKFLOW_ID}"/templates cp "${WORKDIR}"/"${WORKFLOW_ID}"/manifests/* charts/"${WORKFLOW_ID}"/templates git add -A -git commit -m "(${WORKFLOW_ID}) Automated PR" -echo "Automated PR from $PR_OR_COMMIT_URL" | git commit --amend --file=- -git remote set-url origin https://"${GH_TOKEN}"@github.com/"${WF_CONFIG_REPO}" +git commit -m "(m2k-kfunc) Automated PR" +echo "Automated PR from ${PR_OR_COMMIT_URL}" | git commit --amend --file=- +git remote set-url origin https://${GH_TOKEN}@github.com/${WF_CONFIG_REPO} git push origin HEAD -gh pr create -f --title "${WORKFLOW_ID}: Automatic manifests generation" \ +gh pr create -f --title "m2k-kfunc: Automatic manifests generation" \ --body " -Updating generated manifests for ${WORKFLOW_ID} workflow +Updating generated manifests for m2k-kfunc application This PR was created automatically as a result of merging ${PR_OR_COMMIT_URL} " \ No newline at end of file diff --git a/scripts/create_automated_pr.sh b/scripts/create_automated_pr.sh index 0788066e..00811746 100644 --- a/scripts/create_automated_pr.sh +++ b/scripts/create_automated_pr.sh @@ -10,20 +10,21 @@ WF_CONFIG_REPO=$7 git config --global user.email "${USER_EMAIL}" git config --global user.name "${USER_NAME}" gh repo clone "${WF_CONFIG_REPO}" config-repo -cd config-repo +cd config-repo || exit git switch -c "${WORKFLOW_ID}"-autopr-"${RANDOM}" ./../hack/bump_chart_version.sh "${WORKFLOW_ID}" --bump-tag-version - +mkdir -p charts/"${WORKFLOW_ID}"/templates +cp "${WORKDIR}"/"${WORKFLOW_ID}"/manifests/* charts/"${WORKFLOW_ID}"/templates git add -A -git commit -m "(m2k-kfunc) Automated PR" -echo "Automated PR from ${PR_OR_COMMIT_URL}" | git commit --amend --file=- -git remote set-url origin https://${GH_TOKEN}@github.com/${WF_CONFIG_REPO} +git commit -m "(${WORKFLOW_ID}) Automated PR" +echo "Automated PR from $PR_OR_COMMIT_URL" | git commit --amend --file=- +git remote set-url origin https://"${GH_TOKEN}"@github.com/"${WF_CONFIG_REPO}" git push origin HEAD -gh pr create -f --title "m2k-kfunc: Automatic manifests generation" \ +gh pr create -f --title "${WORKFLOW_ID}: Automatic manifests generation" \ --body " -Updating generated manifests for m2k-kfunc application +Updating generated manifests for ${WORKFLOW_ID} workflow This PR was created automatically as a result of merging ${PR_OR_COMMIT_URL} " \ No newline at end of file diff --git a/scripts/create_or_update_automated_pr.sh b/scripts/create_or_update_automated_pr.sh index 1977df19..90b47f13 100644 --- a/scripts/create_or_update_automated_pr.sh +++ b/scripts/create_or_update_automated_pr.sh @@ -11,7 +11,7 @@ USER_EMAIL=$6 USER_NAME=$7 WORKDIR=$8 GH_TOKEN=$9 -WF_CONFIG_REPO=$12 +WF_CONFIG_REPO=${10} # Get all open PRs for the repository prs=$(gh pr list --repo "${REPO}" --json number --jq '.[].number') @@ -21,7 +21,7 @@ for pr in $prs; do echo "Checking PR #$pr..." # Fetch the list of changed files for the PR - files=$(gh pr diff $pr --name-only --repo "${REPO}") + files=$(gh pr diff "$pr" --name-only --repo "${REPO}") # Check if Chart.yaml is in the list of changed files if echo "$files" | grep -q "charts/${WORKFLOW_ID}/Chart.yaml"; then @@ -58,10 +58,10 @@ for pr in $prs; do fi done -sh ${CREATE_PR_SCRIPT} ${USER_EMAIL} \ - ${USER_NAME} \ - ${WORKDIR} \ - ${WORKFLOW_ID} \ - ${PR_OR_COMMIT_URL} \ - ${GH_TOKEN} \ - ${WF_CONFIG_REPO} +sh "${CREATE_PR_SCRIPT}" "${USER_EMAIL}" \ + "${USER_NAME}" \ + "${WORKDIR}" \ + "${WORKFLOW_ID}" \ + "${PR_OR_COMMIT_URL}" \ + "${GH_TOKEN}" \ + "${WF_CONFIG_REPO}"