diff-manifests: never use main explicitly
The base branch name is read from the pull request metadata. Let's use it everywhere and never assume `main`.
This commit is contained in:
parent
b5c47dbe8a
commit
46b127c898
1 changed files with 5 additions and 5 deletions
|
|
@ -36,7 +36,7 @@ git fetch origin "${basebranch}"
|
|||
|
||||
greenprint "Getting revision IDs for HEAD and merge-base"
|
||||
head=$(git rev-parse HEAD)
|
||||
mergebase=$(git merge-base HEAD origin/main)
|
||||
mergebase=$(git merge-base HEAD "origin/${basebranch}")
|
||||
|
||||
if [[ "${head}" == "${mergebase}" ]]; then
|
||||
greenprint "HEAD and merge-base are the same"
|
||||
|
|
@ -67,15 +67,15 @@ greenprint "Checking out merge-base ${mergebase}"
|
|||
git checkout "${mergebase}"
|
||||
|
||||
greenprint "Generating all manifests for merge-base (${mergebase})"
|
||||
# NOTE: it's not an error if this task fails; manifest generation on main can
|
||||
# be broken in a PR that fixes it.
|
||||
# NOTE: it's not an error if this task fails; manifest generation on base
|
||||
# branch can be broken in a PR that fixes it.
|
||||
# As long as the generation on the PR HEAD succeeds, the job should succeed.
|
||||
go run ./cmd/gen-manifests --output "${manifestdir}/${mergebase}" --workers 50
|
||||
err=$?
|
||||
merge_base_fail=""
|
||||
if (( err != 0 )); then
|
||||
greenprint "Manifest generation on merge-base failed"
|
||||
merge_base_fail="**NOTE:** Manifest generation on merge-base with \`main\` (${mergebase}) failed.\n\n"
|
||||
merge_base_fail="**NOTE:** Manifest generation on merge-base with \`${basebranch}\` (${mergebase}) failed.\n\n"
|
||||
fi
|
||||
|
||||
greenprint "Diff: ${manifestdir}/${mergebase} ${manifestdir}/PR"
|
||||
|
|
@ -96,7 +96,7 @@ greenprint "Saved diff in job artifacts"
|
|||
artifacts_url="${CI_JOB_URL}/artifacts/browse/ci-artifacts"
|
||||
|
||||
cat > "${review_data_file}" << EOF
|
||||
{"body":"⚠️ This PR introduces changes in at least one manifest (when comparing PR HEAD ${head} with the main merge-base ${mergebase}). Please review the changes. The changes can be found in the [artifacts of the \`Manifest-diff\` job [0]](${artifacts_url}) as \`manifests.diff\`.\n\n${merge_base_fail}[0] ${artifacts_url}","event":"COMMENT"}
|
||||
{"body":"⚠️ This PR introduces changes in at least one manifest (when comparing PR HEAD ${head} with the ${basebranch} merge-base ${mergebase}). Please review the changes. The changes can be found in the [artifacts of the \`Manifest-diff\` job [0]](${artifacts_url}) as \`manifests.diff\`.\n\n${merge_base_fail}[0] ${artifacts_url}","event":"COMMENT"}
|
||||
EOF
|
||||
|
||||
greenprint "Posting review comment"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue