-
-
Save KyMidd/ad79e6d407934528cd20223c53acee22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get existing auto-link references, if any | |
| EXISTING_AUTOLINK_REFERENCES=$(curl -sL \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN"\ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/$GH_ORG/$GH_REPO/autolinks | jq -r '.[]?.key_prefix' | cut -d '-' -f 1 | awk 'NF') | |
| # Set array of project keys to build for this project | |
| AUTOLINK_REFERENCES_TO_BUILD=$(echo "$AUTOLINK_JIRA_PROJECT_KEYS" | tr ' ' '\n') | |
| # If there are existing auto-link references, remove them from the list of auto-link references to build | |
| if [[ $(echo "$EXISTING_AUTOLINK_REFERENCES" | awk 'NF' | wc -l) -gt 0 ]]; then | |
| while IFS=$'\n' read -r EXISTING_AUTOLINK_REFERENCE; do | |
| AUTOLINK_REFERENCES_TO_BUILD=$(echo "$AUTOLINK_REFERENCES_TO_BUILD" | grep -v "$EXISTING_AUTOLINK_REFERENCE") | |
| done <<< "$EXISTING_AUTOLINK_REFERENCES" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment