Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Last active April 10, 2023 00:10
Show Gist options
  • Save KyMidd/ac740b7df14f5daaa74429b4473bfea6 to your computer and use it in GitHub Desktop.
Save KyMidd/ac740b7df14f5daaa74429b4473bfea6 to your computer and use it in GitHub Desktop.
# Create array to store success/failures
CREATE_AUTOLINK_REFERENCE_SUCCESSES=()
CREATE_AUTOLINK_REFERENCE_ALREADY_EXIST=()
CREATE_AUTOLINK_REFERENCE_FAILURES=()
# Count length of project keys to build and project key total to build
AUTOLINK_REFERENCES_TO_BUILD_LENGTH=$(echo "$AUTOLINK_REFERENCES_TO_BUILD" | awk 'NF' | wc -l | xargs)
AUTOLINK_JIRA_PROJECT_KEYS_LENGTH=$(echo "$AUTOLINK_JIRA_PROJECT_KEYS" | awk 'NF' | wc -l | xargs)
# If any auto-link references to build, loop through them, create as we go
if [[ $(echo "$AUTOLINK_REFERENCES_TO_BUILD" | awk 'NF' | wc -l | xargs) -gt 0 ]]; then
while IFS=$'\n' read -r PROJECT_KEY; do
create_repo_autolink_reference "$PROJECT_KEY"
done <<< "${AUTOLINK_REFERENCES_TO_BUILD[@]}"
fi
# Create counts vars
CREATE_AUTOLINK_REFERENCE_SUCCESSES_LENGTH=${#CREATE_AUTOLINK_REFERENCE_SUCCESSES[@]}
CREATE_AUTOLINK_REFERENCE_ALREADY_EXISTS_LENGTH=${#CREATE_AUTOLINK_REFERENCE_ALREADY_EXIST[@]}
CREATE_AUTOLINK_REFERENCE_FAILURES_LENGTH=${#CREATE_AUTOLINK_REFERENCE_FAILURES[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment