From c0f554ce8dbbeadfcf1ecce1c5aedae24af7d117 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 14 Sep 2023 10:51:55 -0700 Subject: [PATCH] Handle feature branch separately from PR --- .github/workflows/prepare-release.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index f53ba60163..0261149d50 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -57,10 +57,19 @@ jobs: echo "Release branch rc/$RELEASE_VERSION does not exist." echo "create_release_branch=true" >> "$GITHUB_ENV" echo "create_release_pr=true" >> "$GITHUB_ENV" + echo "create_release_feature_branch=true" >> "$GITHUB_ENV" else echo "Release branch rc/$RELEASE_VERSION already exists." echo "create_release_branch=false" >> "$GITHUB_ENV" + if [[ -z $(git ls-remote --heads origin feature/update-user-manual-for-$RELEASE_VERSION) ]]; then + echo "Feature branch feature/update-user-manual-for-$RELEASE_VERSION does not exist." + echo "create_release_feature_branch=true" >> "$GITHUB_ENV" + else + echo "Feature branch feature/update-user-manual-for-$RELEASE_VERSION already exists." + echo "create_release_feature_branch=false" >> "$GITHUB_ENV" + fi + pr_state=$(gh pr view rc/$RELEASE_VERSION --json title,state) pr_title=$(echo "$pr_state" | jq -r '.title') pr_state=$(echo "$pr_state" | jq -r '.state') @@ -109,13 +118,13 @@ jobs: $RELEASE_VERSION - name: Create feature branch for PR - if: env.create_release_pr == 'true' + if: env.create_release_feature_branch == 'true' run: | git switch -c feature/update-user-manual-for-$RELEASE_VERSION git push --set-upstream origin feature/update-user-manual-for-$RELEASE_VERSION - name: Get feature branch for PR - if: env.create_release_pr == 'false' + if: env.create_release_feature_branch == 'false' run: | git fetch origin feature/update-user-manual-for-$RELEASE_VERSION git switch feature/update-user-manual-for-$RELEASE_VERSION @@ -140,6 +149,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.ACTION_DISPATCH_TOKEN }} if: env.create_release_pr == 'true' run: | + git diff gh pr create \ -R $GITHUB_REPOSITORY \ --title "Release v$RELEASE_VERSION" \