diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d365f5b..8fe54ad4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,9 +5,42 @@ on: - main jobs: - Find GitSHA: + Find-GitSHA: name: find Git Sha runs-on: ubuntu-latest steps: - - name: Print commit ID - run: echo "Commit ID: $GITHUB_SHA" + - uses: actions/checkout@v1 + + - name: Extract commit ID and repository information + run: | + COMMIT_ID=$GITHUB_SHA + REPO_INFO=$GITHUB_REPOSITORY + echo "REPO_INFO: $REPO_INFO" + OWNER=$(echo $REPO_INFO | cut -d'/' -f1) + REPO=$(echo $REPO_INFO | cut -d'/' -f2) + echo "Commit ID: $COMMIT_ID" + echo "Repository: $REPO" + echo "Owner: $OWNER" + + - name: Create commit status + run: | + API_HOST=https://api.github.com + OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f1) + REPO=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) + # Check out the PR branch + git checkout $GITHUB_HEAD_REF + # Get the commit ID of the last commit + COMMIT_ID=$(git rev-parse HEAD) + echo "Last commit ID of PR: $COMMIT_ID" + REF=$GITHUB_SHA + echo "Current Commit ID REF : $REF" + STATUS_URL=$API_HOST/repos/$OWNER/$REPO/statuses/$COMMIT_ID + echo "STATUS_URL: $STATUS_URL" + curl -X POST $STATUS_URL \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "state": "success", + "description": "The build was successful.", + "context": "ci/smartui-github-testing" + }' \ No newline at end of file