55 - main
66
77jobs :
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