Skip to content

Commit

Permalink
Handle feature branch separately from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
rvermeulen committed Sep 14, 2023
1 parent 957f959 commit c0f554c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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" \
Expand Down

0 comments on commit c0f554c

Please sign in to comment.