NEW(pmd): @W-17310939@: Add in more AppExchange rules for XML language #782
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] | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
validate_pr_title: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate PR Title | |
if: github.base_ref == 'dev' | |
run: | | |
title="${{ github.event.pull_request.title }}" | |
if [[ "$title" =~ ^(POSTRELEASE|FIX|CHANGE|NEW)([[:space:]]*\([^()]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@[[:space:]]*.+ ]]; then | |
echo "Valid PR title: '$title'" | |
else | |
echo "::error::Invalid PR title: '$title'. Please following the format: POSTRELEASE|FIX|CHANGE|NEW (__) @W-XXXXXXXX@ Summary" | |
exit 1 | |
fi | |
check_for_postrelease_keyword: | |
runs-on: macos-latest | |
outputs: | |
is-postrelease: ${{ steps.main.outputs.is_postrelease }} | |
steps: | |
- name: Check for "Postrelease" keyword in PR title. | |
id: main | |
if: github.base_ref == 'dev' | |
run: | | |
title="${{ github.event.pull_request.title }}" | |
if [[ "$title" =~ ^POSTRELEASE ]]; then | |
echo "is_postrelease=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "is_postrelease=false" >> "$GITHUB_OUTPUT" | |
fi | |
validate_packages: | |
runs-on: macos-latest | |
needs: check_for_postrelease_keyword | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Validate that changed packages are versioned as snapshots | |
if: ${{ needs.check_for_postrelease_keyword.outputs.is-postrelease == 'false' }} | |
run: | | |
BASE_SHA=${{ github.event.pull_request.base.sha }} | |
HEAD_SHA=${{ github.event.pull_request.head.sha }} | |
CHANGED_FILES=`git diff --name-only $HEAD_SHA $BASE_SHA` | |
node ./.github/workflows/verify-pr/validate-changed-package-versions.js "$CHANGED_FILES" | |
- name: Validate that packages properly depend on each other | |
if: ${{ needs.check_for_postrelease_keyword.outputs.is-postrelease == 'false' }} | |
run: | | |
cd packages | |
PACKAGE_NAMES=`ls` | |
cd .. | |
node ./.github/workflows/verify-pr/validate-package-interdependencies.js "$PACKAGE_NAMES" | |
run_tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- run: npm install | |
- run: npm run all |