CHANGE @W-17526120@ Telemetry for A4D events #550
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: validate-pr | |
on: | |
pull_request: | |
types: [edited, opened, reopened, synchronize] | |
jobs: | |
# VALIDATE PR TITLE FORMAT | |
verify_pr_title: | |
runs-on: ubuntu-latest | |
name: Verify that PR title contains well-formed GUS work item tag. | |
steps: | |
# Private actions must check out repo first. | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Verify PR Title | |
run: | | |
title="${{ github.event.pull_request.title }}" | |
title_upper=$(echo "$title" | tr '[:lower:]' '[:upper:]') | |
base_ref="${{ github.base_ref }}" | |
# Define regex patterns for different types of PR titles | |
MAIN2DEV_REGEX="^MAIN2DEV[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.*MERGING.+[[:digit:]]{1,2}\.[[:digit:]]{1,2}\.[[:digit:]]{1,2}.*" | |
RELEASE2MAIN_REGEX="^RELEASE[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+" | |
PR_INTO_DEV_OR_RELEASE_REGEX="^(FIX|CHANGE|NEW)([[:space:]]*\([a-zA-Z]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@.+" | |
# Validate PR title based on base_ref and head_ref | |
if [[ "$base_ref" == "dev" && "${{ startsWith(github.head_ref, 'm2d/') }}" == "true" && ! "$title_upper" =~ $MAIN2DEV_REGEX ]]; then | |
echo "::error::Invalid PR title: '$title'. Please follow the format: Main2Dev (__) @W-XXXXXXXX@ Merging.*\d+\.\d+\.\d+" | |
exit 1 | |
elif [[ "$base_ref" == "main" && ! "$title_upper" =~ $RELEASE2MAIN_REGEX ]]; then | |
echo "::error::Invalid PR title: '$title'. Please follow the format: RELEASE @W-XXXXXXXX@ Summary" | |
exit 1 | |
elif [[ ("$base_ref" == "dev" || "${{ startsWith(github.base_ref, 'release-') }}" == "true") && ! "$title_upper" =~ $PR_INTO_DEV_OR_RELEASE_REGEX ]]; then | |
echo "::error::Invalid PR title: '$title'. Please follow the format: FIX|CHANGE|NEW (__) @W-XXXXXXXX@ Summary" | |
exit 1 | |
else | |
echo "PR title '$title' automatically accepted for $base_ref branch." | |
fi | |
# If no errors, print success | |
echo "Valid PR title: '$title'" | |
# RUN TESTS | |
# Step 1: Build the scanner tarball so it can be installed locally. | |
build_v4_scanner_tarball: | |
name: 'Build v4 scanner tarball' | |
uses: ./.github/workflows/build-scanner-tarball.yml | |
with: | |
target-branch: 'dev-4' | |
build_v5_scanner_tarball: | |
name: 'Build v5 scanner tarball' | |
uses: ./.github/workflows/build-scanner-tarball.yml | |
with: | |
target-branch: 'dev' | |
# Step 2: Actually run the tests. | |
run_tests: | |
name: 'Run unit tests' | |
needs: [build_v4_scanner_tarball, build_v5_scanner_tarball] | |
uses: ./.github/workflows/run-tests.yml | |
with: | |
# We want to validate the extension against whatever version of the scanner we | |
# *plan* to publish, not what's *already* published. | |
use-scanner-tarballs: true | |
v4-tarball-suffix: 'dev-4' | |
v5-tarball-suffix: 'dev' | |
# BUILD A VSIX ARTIFACT | |
# Additionally, build a VSIX that can be downloaded by the user if needed. | |
create-vsix-artifact: | |
name: 'Upload VSIX as artifact' | |
uses: ./.github/workflows/create-vsix-artifact.yml |