diff --git a/.github/workflows/telegram-bot.yml b/.github/workflows/telegram-bot.yml index a6b854cb..2fbcec96 100644 --- a/.github/workflows/telegram-bot.yml +++ b/.github/workflows/telegram-bot.yml @@ -40,37 +40,37 @@ jobs: run: | if [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "opened" ]]; then - ESCAPED_NAME=`echo -e "${{ env.PR_NAME }}" | sed 's/\&/\&/g' | sed 's//\>/g'` - TEXT=`echo -e "${{ env.PR_AUTHOR }} created new PR#${{ env.PR_NUMBER }} '$ESCAPED_NAME' to branch '${{ env.PR_BASE }}'"` + ESCAPED_NAME=`echo -e "$PR_NAME" | sed 's/\&/\&/g' | sed 's//\>/g'` + TEXT=`echo -e "$PR_AUTHOR created new PR#$PR_NUMBER '$ESCAPED_NAME' to branch '$PR_BASE'"` elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "synchronize" ]]; then - TEXT=`echo -e "${{ env.PR_AUTHOR }} updated PR#${{ env.PR_NUMBER }}"` + TEXT=`echo -e "$PR_AUTHOR updated PR#$PR_NUMBER"` elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true" ]]; then - TEXT=`echo -e "${{ env.PR_MERGED }} merged PR#${{ env.PR_NUMBER }} to branch '${{ env.PR_BASE }}'"` + TEXT=`echo -e "$PR_MERGED merged PR#$PR_NUMBER to branch '$PR_BASE'"` elif [[ ! -z "${{ github.event.pull_request }}" && "${{ github.event.action }}" == "closed" ]]; then - TEXT=`echo -e "${{ env.PR_AUTHOR }} closed PR#${{ env.PR_NUMBER }}"` + TEXT=`echo -e "$PR_AUTHOR closed PR#$PR_NUMBER"` elif [[ ! -z "${{ github.event.comment }}" ]]; then - ESCAPED_TEXT=`echo -e "${{ env.COMMENT_BODY }}"| sed 's/\&/\&/g' | sed 's//\>/g'` + ESCAPED_TEXT=`echo -e "$COMMENT_BODY"| sed 's/\&/\&/g' | sed 's//\>/g'` if [[ ! -z "${{ github.event.pull_request }}" ]]; then - TEXT=`echo -e "${{ env.COMMENT_AUTHOR }} posted the following comment to file ${{ env.COMMENT_FILE }} in PR#${{ env.PR_NUMBER }}:\n$ESCAPED_TEXT"` + TEXT=`echo -e "$COMMENT_AUTHOR posted the following comment to file $COMMENT_FILE in PR#$PR_NUMBER:\n$ESCAPED_TEXT"` else - TEXT=`echo -e "${{ env.COMMENT_AUTHOR }} posted the following comment to issue #${{ env.COMMENT_NUMBER }}:\n$ESCAPED_TEXT"` + TEXT=`echo -e "$COMMENT_AUTHOR posted the following comment to issue #$COMMENT_NUMBER:\n$ESCAPED_TEXT"` fi - elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" == "changes_requested" ]]; then - TEXT=`echo -e "${{ env.REVIEW_AUTHOR }} requested changes for PR#${{ env.PR_NUMBER }}"` - elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" == "commented" && ! -z "${{ env.REVIEW_COMMENT }}" ]]; then - ESCAPED_TEXT=`echo -e "${{ env.REVIEW_COMMENT }}"| sed 's/\&/\&/g' | sed 's//\>/g'` - TEXT=`echo -e "${{ env.REVIEW_AUTHOR }} posted the following comment to PR#${{ env.PR_NUMBER }}:\n$ESCAPED_TEXT"` - elif [[ ! -z "${{ github.event.review }}" && "${{ env.REVIEW_STATE }}" != "commented" ]]; then - TEXT=`echo -e "${{ env.REVIEW_AUTHOR }} ${{ env.REVIEW_STATE }} PR#${{ env.PR_NUMBER }}"` + elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" == "changes_requested" ]]; then + TEXT=`echo -e "$REVIEW_AUTHOR requested changes for PR#$PR_NUMBER"` + elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" == "commented" && ! -z "$REVIEW_COMMENT" ]]; then + ESCAPED_TEXT=`echo -e "$REVIEW_COMMENT"| sed 's/\&/\&/g' | sed 's//\>/g'` + TEXT=`echo -e "$REVIEW_AUTHOR posted the following comment to PR#$PR_NUMBER:\n$ESCAPED_TEXT"` + elif [[ ! -z "${{ github.event.review }}" && "$REVIEW_STATE" != "commented" ]]; then + TEXT=`echo -e "$REVIEW_AUTHOR $REVIEW_STATE PR#$PR_NUMBER"` elif [[ -z "${{ github.event.review }}" && "${{ github.event.action }}" == "submitted" ]]; then - TEXT=`echo -e "Due to GitHub Actions bug we cannot identify, who approved PR#${{ env.PR_NUMBER }}"` + TEXT=`echo -e "Due to GitHub Actions bug we cannot identify, who approved PR#$PR_NUMBER"` elif [[ ! -z "${{ github.event.workflow_run }}" && "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then - TEXT=`echo -e "Universum run for branch '${{ env.UNIVERSUM_BRANCH }}' SUCCEDED; commit ${{ env.UNIVERUM_COMMIT }} "` + TEXT=`echo -e "Universum run for branch "$UNIVERSUM_BRANCH" SUCCEDED; commit "$UNIVERSUM_BRANCH" "` elif [[ ! -z "${{ github.event.workflow_run }}" && "${{ github.event.workflow_run.conclusion }}" == "failure" ]]; then - TEXT=`echo -e "Universum run for branch '${{ env.UNIVERSUM_BRANCH }}' FAILED; commit ${{ env.UNIVERUM_COMMIT }} "` + TEXT=`echo -e "Universum run for branch "$UNIVERSUM_BRANCH" FAILED; commit "$UNIVERSUM_BRANCH" "` fi if [[ ! -z $TEXT ]]; then