Don't modify CHANGELOG.md if the PR was submitted from master/main branches. Eliminates the pipeline error, when the fork is used.
@@ -162,14 +162,15 @@ pipelines:
echo "PR was not created (already exists from this head branch?). PR link is empty!"
exit 1
fi
- - cd ${res_GitHubTFProviderRepoJFrog_resourcePath}
- - git checkout -b ${res_GitHubTFProviderRepoJFrog_headCommitRef}
- - sed -i -E "0,/(##\s.+\..+\..+\s\(.+\)).*/ s/(##\s.+\..+\..+\s\(.+\)).*/\1. Tested on Artifactory ${ARTIFACTORY_VERSION}/" CHANGELOG.md
- - head -10 CHANGELOG.md
- - git add CHANGELOG.md
- - export REGEX="Changes to be committed*"
- - export GIT_STATUS=$(git status)
- >-
+ if [[ "${res_GitHubTFProviderRepoJFrog_headCommitRef}" != master ]] || [[ "${res_GitHubTFProviderRepoJFrog_headCommitRef}" != main ]]; then
+ cd ${res_GitHubTFProviderRepoJFrog_resourcePath}
+ git checkout -b ${res_GitHubTFProviderRepoJFrog_headCommitRef}
+ sed -i -E "0,/(##\s.+\..+\..+\s\(.+\)).*/ s/(##\s.+\..+\..+\s\(.+\)).*/\1. Tested on Artifactory ${ARTIFACTORY_VERSION}/" CHANGELOG.md
+ head -10 CHANGELOG.md
+ git add CHANGELOG.md
+ export REGEX="Changes to be committed*"
+ export GIT_STATUS=$(git status)
if [[ ${GIT_STATUS} =~ ${REGEX} ]]; then
echo "Adding Artifactory version to CHANGELOG.md"
git config --global user.name 'JFrog CI'
@@ -181,6 +182,7 @@ pipelines:
else
echo "There is nothing to commit, Artifactory version didn't change since last commit"
fi
+ fi
onSuccess:
- echo "Success"
- send_notification partnersSlack --text "<${res_GitHubTFProviderRepoJFrog_gitRepoRepositoryHttpsUrl}|Terraform Provider>. A new PR was submitted by *${PR_COMMITTER}* - <${PR_URL}|${PR_TITLE}>, branch *${PR_BRANCH}*. Changes tested successfully. <@U01H1SLSPA8> please, review and merge."
