Skip to content

chore: improve logging on retried upload failures #1234

chore: improve logging on retried upload failures

chore: improve logging on retried upload failures #1234

name: "Trigger CircleCi Pipeline"
on:
pull_request_target:
types:
- opened
- ready_for_review
jobs:
main:
name: Trigger CircleCi Pipeline when PR is ready for review
runs-on: ubuntu-latest
steps:
- if: ${{ github.event.pull_request.draft == false }}
shell: bash
env:
CIRCLE_TOKEN: ${{ secrets.CIRCLE_TOKEN }}
BASE_ORG_AND_REPO: ${{ github.event.pull_request.head.full_name }}
PULL_ID: ${{ github.event.pull_request.number }}
run: |
if [[ "${CIRCLE_TOKEN}" == "" ]]; then
echo "The CIRCLE_TOKEN is unset. Cannot trigger pipeline..."
exit 1;
fi
BRANCH="$GITHUB_HEAD_REF"
if [[ "$BASE_ORG_AND_REPO" != "cypress-io/cypress" ]]; then
echo "Triggering CircleCi pipeline for outside contributor."
BRANCH="pull/$PULL_ID/head"
fi
echo "Triggering CircleCi pipeline for $BRANCH"
response=$(curl -X POST https://circleci.com/api/v2/project/github/cypress-io/cypress/pipeline \
--header "Circle-Token:$CIRCLE_TOKEN" \
--header "content-type:application/json" \
--data "{\"branch\":\"$BRANCH\"}" \
--silent
)
echo "$response"
if [ "$(jq 'has("message")' <<< $response )" == "true" ]; then
echo "Error triggering pipeline..."
exit 1;
fi