0

This script is run when xcodebuild completed

If Pull request is opened, It works. (Once build finished, this script leave a comment on PR)

The problem is It is not working once PR is merged or closed.

The error message is

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest"
}

ci_scripts/ci_post_xcodebuild.sh

# Github Comment message
COMMENT_BODY=""

case $CI_XCODEBUILD_ACTION in
    "analyze")
        echo "Performing analyze action"
        ;;
    "archive")
        COMMENT_BODY=" archive Xcode Cloud completed -> ${CI_XCODE_SCHEME} Build Number is ${CI_BUILD_NUMBER}\nThis message was generated by an Xcode Cloud build script."
        ;;
    "build")
    #TODO Add marketing version
        COMMENT_BODY=" build Xcode Cloud completed -> ${CI_XCODE_SCHEME} Build Number is ${CI_BUILD_NUMBER}\nThis message was generated by an Xcode Cloud build script."
        ;;
    "build-for-testing")
        echo "Performing build-for-testing action"
        ;;
    "test-without-building")
        echo "Performing test-without-building action"
        ;;
    *)
        echo "Invalid CI_XCODEBUILD_ACTION value: $CI_XCODEBUILD_ACTION"
        ;;
esac

echo "Leave a message (${COMMENT_BODY}) in PR (${CI_PULL_REQUEST_NUMBER})"

curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
 -X POST -d "{\"body\": \"$COMMENT_BODY\"}" \
 "https://api.github.com/repos/team/repo-name/issues/$CI_PULL_REQUEST_NUMBER/comments"
Shawn Baek
  • 1,928
  • 3
  • 20
  • 34
  • I found one issue. It's not a GitHub problem Once PR has merged, Xcode Cloud CI_PULL_REQUEST_NUMBER returns empty string – Shawn Baek Jul 07 '23 at 06:42

0 Answers0