Skip to content

Commit 6fdfada

Browse files
JeeveshJ7JeeveshJ7
authored andcommitted
PR check action
1 parent b2629da commit 6fdfada

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/Pr-check.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: SmartUI PR Check with NodeJS SDK
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
env:
9+
LT_USERNAME: ${{ secrets.LT_USERNAME }}
10+
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
11+
PROJECT_TOKEN: ${{ secrets.PROJECT_TOKEN }}
12+
LT_SDK_DEBUG: true
13+
SMARTUI_DEBUG: true
14+
15+
jobs:
16+
smartui-pr-check:
17+
name: Execute SmartUI PR Check with NodeJS SDK
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v3
23+
with:
24+
ref: ${{ github.head_ref }}
25+
26+
- name: Find Last CommitId
27+
run: |
28+
API_HOST=https://api.github.com
29+
# Get the commit ID of the last commit
30+
COMMIT_ID=$(git rev-parse HEAD)
31+
echo "Last commit ID of PR: $COMMIT_ID"
32+
GITHUB_URL=$API_HOST/repos/$GITHUB_REPOSITORY/statuses/$COMMIT_ID
33+
echo "GITHUB_URL: $GITHUB_URL"
34+
echo "GITHUB_URL=$GITHUB_URL" >> $GITHUB_ENV
35+
36+
- name: Install Node.js
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: '14' # Use the appropriate Node.js version for your project
40+
41+
- name: Install Dependencies
42+
run: |
43+
npm ci
44+
45+
- name: Install SmartUI SDK
46+
run: |
47+
npm install @lambdatest/smartui-cli
48+
49+
- name: Set up SmartUI Config
50+
run: |
51+
npx smartui config:create smartui-config.json
52+
53+
- name: Execute SmartUI Tests
54+
run: |
55+
npx smartui --config smartui-config.json exec -- npm run smartui-cloud
56+
env:
57+
SMARTUI_PROJECT_NAME: "your-project-name" # Replace with your SmartUI project name
58+
SMARTUI_BUILD_NAME: ${{ github.sha }}
59+
60+
- name: Check for Visual Changes
61+
run: |
62+
echo "Checking for visual differences..."
63+
64+
- name: Comment on PR with Results
65+
if: failure()
66+
run: |
67+
echo "Visual differences found. Please review the SmartUI report."
68+
# You can add code to post this comment to the PR using GitHub API

0 commit comments

Comments
 (0)