ci: fix ahead-check for working branch (#2120)

Also list remote branches during on-release
This commit is contained in:
Otto Bittner 2023-07-19 17:48:29 +02:00 committed by GitHub
parent ac575c9a2c
commit c58d03a7b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -35,14 +35,14 @@ jobs:
PART_MINOR=${WITHOUT_V#*.}
MAJOR_MINOR=${PART_MAJOR}.${PART_MINOR}
RELEASE_BRANCH="release/v${MAJOR_MINOR}"
WORKING_BRANCH_PREFIX="tmp/${FULL_VERSION}"
WORKING_BRANCH_PREFIX="origin/tmp/${FULL_VERSION}"
echo "RELEASE_BRANCH=${RELEASE_BRANCH}" | tee -a "$GITHUB_ENV"
echo "WORKING_BRANCH_PREFIX=${WORKING_BRANCH_PREFIX}" | tee -a "$GITHUB_ENV"
- name: Find temporary branch
id: find-temporary-branch
run: |
working_branch_count=$(git branch --list "${WORKING_BRANCH_PREFIX}*" | wc -l)
working_branch_count=$(git branch --list -r "${WORKING_BRANCH_PREFIX}*" | wc -l)
if [[ "${working_branch_count}" -ne 1 ]]; then
echo "More than one (or zero) temporary branches found. Cannot finish transaction."
git branch --list "${WORKING_BRANCH_PREFIX}*"

View File

@ -131,7 +131,7 @@ jobs:
git checkout "${RELEASE_BRANCH}" || exit 0
git checkout "${WORKING_BRANCH}"
ahead=$(git rev-list HEAD --not "${RELEASE_BRANCH}" | wc -l)
if [[ "${ahead}" -gt 0 ]]; then
if [[ "${ahead}" -eq 0 ]]; then
echo "The current branch is not strictly ahead of the release branch. Please rebase."
exit 1
fi