Skip to content

Commit

Permalink
FFiixx
Browse files Browse the repository at this point in the history
Signed-off-by: gabriel-farache <[email protected]>
  • Loading branch information
gabriel-farache committed Oct 9, 2024
1 parent 457abb8 commit cabed53
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
14 changes: 7 additions & 7 deletions scripts/create_automated_m2k_kfunc_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ 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

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}
"
15 changes: 8 additions & 7 deletions scripts/create_automated_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
"
18 changes: 9 additions & 9 deletions scripts/create_or_update_automated_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down Expand Up @@ -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}"

0 comments on commit cabed53

Please sign in to comment.