Skip to content

Commit f4b1bf2

Browse files
authored
Merge pull request #2 from LambdaTest/stage
fix error
2 parents a08422f + f1a6098 commit f4b1bf2

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,42 @@ on:
55
- main
66

77
jobs:
8-
Find GitSHA:
8+
Find-GitSHA:
99
name: find Git Sha
1010
runs-on: ubuntu-latest
1111
steps:
12-
- name: Print commit ID
13-
run: echo "Commit ID: $GITHUB_SHA"
12+
- uses: actions/checkout@v1
13+
14+
- name: Extract commit ID and repository information
15+
run: |
16+
COMMIT_ID=$GITHUB_SHA
17+
REPO_INFO=$GITHUB_REPOSITORY
18+
echo "REPO_INFO: $REPO_INFO"
19+
OWNER=$(echo $REPO_INFO | cut -d'/' -f1)
20+
REPO=$(echo $REPO_INFO | cut -d'/' -f2)
21+
echo "Commit ID: $COMMIT_ID"
22+
echo "Repository: $REPO"
23+
echo "Owner: $OWNER"
24+
25+
- name: Create commit status
26+
run: |
27+
API_HOST=https://api.github.com
28+
OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1)
29+
REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)
30+
# Check out the PR branch
31+
git checkout $GITHUB_HEAD_REF
32+
# Get the commit ID of the last commit
33+
COMMIT_ID=$(git rev-parse HEAD)
34+
echo "Last commit ID of PR: $COMMIT_ID"
35+
REF=$GITHUB_SHA
36+
echo "Current Commit ID REF : $REF"
37+
STATUS_URL=$API_HOST/repos/$OWNER/$REPO/statuses/$COMMIT_ID
38+
echo "STATUS_URL: $STATUS_URL"
39+
curl -X POST $STATUS_URL \
40+
-H "Authorization: Bearer $GITHUB_TOKEN" \
41+
-H "Content-Type: application/json" \
42+
-d '{
43+
"state": "success",
44+
"description": "The build was successful.",
45+
"context": "ci/smartui-github-testing"
46+
}'

0 commit comments

Comments
 (0)