1+ name : PR Checks
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+
8+ permissions :
9+ contents : read
10+ pull-requests : write
11+
12+ jobs :
13+ # Detect changes to determine what needs to be checked
14+ changes :
15+ runs-on : ubuntu-latest
16+ outputs :
17+ cli : ${{ steps.filter.outputs.cli }}
18+ sdk : ${{ steps.filter.outputs.sdk }}
19+ workflows : ${{ steps.filter.outputs.workflows }}
20+ steps :
21+ - uses : actions/checkout@v4
22+
23+ - uses : dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v3.0.1
24+ id : filter
25+ with :
26+ filters : |
27+ cli:
28+ - 'packages/cli/src/**'
29+ - 'packages/cli/package.json'
30+ - 'packages/cli/tsconfig.json'
31+ sdk:
32+ - 'src/**'
33+ - 'package.json'
34+ - 'tsconfig.json'
35+ workflows:
36+ - '.github/workflows/**'
37+
38+ # Build and test
39+ build :
40+ needs : changes
41+ uses : ./.github/workflows/build.yml
42+ with :
43+ upload_artifacts : false
44+ permissions :
45+ contents : read
46+
47+ # Check versions to ensure they will publish correctly
48+ version-check :
49+ runs-on : ubuntu-latest
50+ needs : changes
51+ if : needs.changes.outputs.sdk == 'true' || needs.changes.outputs.cli == 'true'
52+ steps :
53+ - uses : actions/checkout@v4
54+
55+ - name : Setup Node.js
56+ uses : actions/setup-node@v4
57+ with :
58+ node-version : ' 20'
59+ registry-url : ' https://npm.pkg.github.com'
60+
61+ - name : Check SDK version
62+ if : needs.changes.outputs.sdk == 'true'
63+ run : |
64+ CURRENT_VERSION=$(node -p "require('./package.json').version")
65+ echo "SDK version: $CURRENT_VERSION"
66+
67+ # Check if version already exists
68+ if npm view @uipath/uipath-typescript@$CURRENT_VERSION version 2>/dev/null; then
69+ echo "::warning::SDK version $CURRENT_VERSION already exists. Version bump will be required on merge."
70+ else
71+ echo "✅ SDK version $CURRENT_VERSION is available for publishing"
72+ fi
73+ env :
74+ GH_NPM_REGISTRY_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+
76+ - name : Check CLI version
77+ if : needs.changes.outputs.cli == 'true'
78+ working-directory : packages/cli
79+ run : |
80+ CURRENT_VERSION=$(node -p "require('./package.json').version")
81+ echo "CLI version: $CURRENT_VERSION"
82+
83+ # Check if version already exists
84+ if npm view @uipath/cli@$CURRENT_VERSION version 2>/dev/null; then
85+ echo "::warning::CLI version $CURRENT_VERSION already exists. Version bump will be required on merge."
86+ else
87+ echo "✅ CLI version $CURRENT_VERSION is available for publishing"
88+ fi
89+ env :
90+ GH_NPM_REGISTRY_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments