blackduck update: do not fail if branch already exists (#17417)

This commit is contained in:
Gary Verhaegen 2023-09-18 16:25:05 +02:00 committed by GitHub
parent ce3fcf1d8c
commit 8494cff36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -174,8 +174,11 @@ jobs:
latest=$(git ls-remote https://github.com/DACH-NY/security-blackduck.git master | awk '{print $1}')
current=$(cat ci/blackduck.yml | grep blackduck_script_sha: | head -1 | cut -f2 -d: | cut -c2- )
if [ "$current" != "$latest" ]; then
branch="bump-blackduck-script-${latest:0:8}"
branch="bump-blackduck-script-${latest:0:8}"
if git ls-remote --exit-code --heads https://github.com/digital-asset/daml.git refs/heads/$branch >/dev/null; then
echo "$branch already exists, nothing to do."
elif [ "$current" != "$latest" ]; then
echo "s|blackduck_script_sha: $current|blackduck_script_sha: $latest|"
sed -i "s|blackduck_script_sha: $current|blackduck_script_sha: $latest|" ci/blackduck.yml
git add ci/blackduck.yml