Skip to content

Commit b953f1f

Browse files
Extra checks
1 parent f958527 commit b953f1f

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/version-history.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ jobs:
104104
git config pull.rebase false
105105
106106
branch="${{ inputs.target_branch || format('automated-update-for-image-history-{0}', github.run_id) }}"
107-
git checkout -b $branch
107+
if [ -n "${{ inputs.target_branch }}" ]; then
108+
git checkout $branch
109+
else
110+
git checkout -b $branch
111+
fi
108112
message='Automated update for image history'
109113
110114
# Add / update and commit
@@ -114,12 +118,15 @@ jobs:
114118
# Push (unless disabled for testing)
115119
if [ "$NO_UPDATES" != "true" ] && [ "${{ inputs.push }}" = "true" ]; then
116120
git push origin "$branch"
117-
gh api \
118-
--method POST \
119-
-H "Accept: application/vnd.github+json" \
120-
/repos/${GITHUB_REPOSITORY}/pulls \
121-
-f title="$message" \
122-
-f body="$message" \
123-
-f head="$branch" \
124-
-f base='main'
125121
fi
122+
123+
if [ -z "${{ inputs.target_branch }}" ]; then
124+
gh api \
125+
--method POST \
126+
-H "Accept: application/vnd.github+json" \
127+
/repos/${GITHUB_REPOSITORY}/pulls \
128+
-f title="$message" \
129+
-f body="$message" \
130+
-f head="$branch" \
131+
-f base='main'
132+
fi

0 commit comments

Comments
 (0)