Skip to content

Commit

Permalink
BUGFIX: Use CIRCLE_BRANCH when we are not triggered by a PR
Browse files Browse the repository at this point in the history
  • Loading branch information
markusguenther committed Sep 20, 2024
1 parent 863412f commit 30879db
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ jobs:
- run:
name: Define target branch
command: |
TARGET_BRANCH=$(gh pr view $CIRCLE_PULL_REQUEST --json baseRefName --jq '.baseRefName')
# Get the target branch of the PR but when we are not one a PR, use the current branch
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
TARGET_BRANCH=$(gh pr view $CIRCLE_PULL_REQUEST --json baseRefName --jq '.baseRefName')
else
TARGET_BRANCH=$CIRCLE_BRANCH
fi
echo "Target Branch: $TARGET_BRANCH"
# Save the variable to BASH_ENV to be able to access it in the next steps
echo "export TARGET_BRANCH=$TARGET_BRANCH" >> $BASH_ENV
Expand Down

0 comments on commit 30879db

Please sign in to comment.