tisonkun commented on PR #16495:
URL: https://github.com/apache/pulsar/pull/16495#issuecomment-1179549016

   @Shoothzj in the pulsarbot actions, we already validate input as:
   
   ```shell
   if [[ ${COMMENT_BODY} != "${BOT_COMMAND_PREFIX}"* ]]; then
       echo "Not a pulsarbot command, skipping it ..."
       exit
   fi
   
   read -r -a commands <<< "${COMMENT_BODY}"
   BOT_COMMAND=${commands[1]}
   CHECK_NAME=""
   if [ "${BOT_COMMAND}" == "rerun-failure-checks" ]; then
       CHECK_NAME="_all"
   elif [ "${BOT_COMMAND}" == "run-failure-checks" ]; then
       CHECK_NAME="_all"
   elif [ "${BOT_COMMAND}" == "run" ]; then
       CHECK_NAME=${commands[2]}
   elif [ "${BOT_COMMAND}" == "rerun" ]; then
       CHECK_NAME=${commands[2]}
   else
       echo "Invalid bot command '${BOT_COMMAND}', skip ..."
       exit
   fi
   
   if [[ "${CHECK_NAME}" == "" ]]; then
       echo "Invalid check name '${CHECK_NAME}', skip ..."
       exit
   fi
   ```
   
   Previously, we add an early filter in workflow file as `startsWith(..., 
'/pulsarbot')`. However, contributor's comments are likely to contain extra 
whitespace, such as:
   
   ```
   
   /pulsarbot run-failure-checks
   
   ```
   
   In https://github.com/apache/pulsar-test-infra/pull/54 I create patch to 
trim all whitespace but the script will still validate commands. If we keep the 
filter as `startsWith`, commands with leading whitespace will be skipped.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to