Skip to content

Translation Pipeline PR #36498

Translation Pipeline PR

Translation Pipeline PR #36498

Workflow file for this run

name: Preview Synthetics
on:
pull_request:
types: [opened, synchronize]
branches:
- master
workflow_dispatch: # allows manual trigger
# Stop the current running job if a new push is made to the PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
synthetic_testing:
if: github.ref != 'refs/heads/guacbot/translation-pipeline'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.ref }}
path: repo
sparse-checkout: |
.
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${{ github.event.pull_request.head.ref }})" >>$GITHUB_OUTPUT
id: extract_branch
- name: Check preview status
id: check-status
run: |
URL="https://docs-staging.datadoghq.com/${{steps.extract_branch.outputs.branch}}"
SUCCESS_CODES=("200" "302" "304")
for i in {1..30}
do
status=$(curl -o /dev/null -s -w "%{http_code}\n" $URL)
if [[ " ${SUCCESS_CODES[@]} " =~ " ${status} " ]]; then
echo "Preview site has been deployed"
break
else
echo "Waiting for preview site to return 200 || 302 || 304..."
echo "Currently returning ${status}"
sleep 30
fi
if [[ $i -eq 30 && ! (" ${SUCCESS_CODES[@]} " =~ " ${status} ") ]]; then
echo "Preview site returned ${status} for 15 minutes, there may be an issue with the preview site build"
exit 1
fi
done
- name: Run Datadog Synthetic tests
uses: DataDog/[email protected]
env:
CI_COMMIT_REF_NAME: ${{steps.extract_branch.outputs.branch}}
with:
api_key: ${{secrets.DD_API_KEY}}
app_key: ${{secrets.DD_APP_KEY}}
config_path: 'repo/datadog-ci.preview.json'
# Override the WEBSITE variable to point to the preview site whereever referenced in the synthetics test
variables: 'WEBSITE=https://docs-staging.datadoghq.com/${{env.CI_COMMIT_REF_NAME}}/'