No more put ‘No test notes’ at Test Flight

No test notes.

It’s not clear what to test using this build

Setup Xcode Cloud Workflow

To get a Github PR infos from Xcode Cloud, You should enable settings like below

Environment

  • Set your Github Token

  • Set Xcode Version – Latest Release

Start Conditions -> See Apple Document

  • CI_PULL_REQUEST_NUMBER

  • CI_PULL_REQUEST_SOURCE_COMMIT

  • CI_PULL_REQUEST_TARGET_COMMIT

To get CI_PULL_REQUEST variables You should set Pull Request Changes as Start Condition

Post Actions

  • Set Test Flight Internal Testing

 

ci_scripts/ci_post_clone.sh

#!/bin/sh
brew install jq

 

ci_scripts/ci_post_xcodebuild.sh

#!/bin/zsh
#  ci_post_xcodebuild.sh

# PR Description
GITHUB_REST_API_PR_INFO=$(curl -L\
  -H "Accept: vnd.github+json" \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  "https://api.github.com/repos/$CI_PULL_REQUEST_TARGET_REPO/pulls/$CI_PULL_REQUEST_NUMBER")

# Fixed: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped, https://stackoverflow.com/questions/52399819/invalid-string-control-characters-from-u0000-through-u001f-must-be-escaped-us
PR_TITLE=$(printf '%s\n' "$GITHUB_REST_API_PR_INFO" | jq -r '.title')

PR_DESCRIPTION=$(printf '%s\n' "GITHUB_REST_API_PR_INFO" | jq -r '.body')
PR_DESCRIPTION_URLS=$(echo "$PR_DESCRIPTION" | grep -Eo 'https?://[^[:space:]]+')
PR_DESCRIPTION_JIRA_TICKETS=$(echo "$PR_DESCRIPTION_URLS" | grep 'atlassian')

# GIT COMMITS
COMMIT_MESSAGES=$(git log $CI_PULL_REQUEST_TARGET_COMMIT^..$CI_PULL_REQUEST_SOURCE_COMMIT --pretty=format:"%s\n%b")
FORMATTED_COMMIT_MESSAGES=$(echo -e "$COMMIT_MESSAGES" | awk 'NF {print}' ORS='\n')

# TEST FLIGHT - What To Test
WHAT_TO_TEST="$PR_TITLE\nCommits:\n$FORMATTED_COMMIT_MESSAGES\nJIRA Tickets:\n$PR_DESCRIPTION_JIRA_TICKETS"

if [[ -d "$CI_APP_STORE_SIGNED_APP_PATH" ]]; then
  TESTFLIGHT_DIR_PATH=../TestFlight
  mkdir $TESTFLIGHT_DIR_PATH
  echo "$WHAT_TO_TEST" >! $TESTFLIGHT_DIR_PATH/WhatToTest.en-US.txt
fi

 

Auto-Generated Test Notes

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby