Revert "Revert "chore: change test"" #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Get Commit Hash on PR Merge" | |
on: | |
pull_request: | |
branches: [main, release] | |
types: | |
- closed | |
jobs: | |
get_commit_hash: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: '2' | |
- name: Get commit hashes | |
if: ${{ github.event.pull_request.merged == true }} | |
env: | |
BASE_BRANCH: ${{ github.event.pull_request.base.ref }} | |
run: | | |
git checkout $BASE_BRANCH | |
echo "Current Commit: $(git rev-parse HEAD)" | |
echo "Before Commit: $(git rev-parse HEAD^)" | |
id=$(curl --location "http://localhost:6789/analyze/createTask" --header "X-TT-ENV: canary" --header "Content-Type: application/json" --header "X-SEMI-Request: ${{ secrets.SEMI_REQUEST }}" --data "{\"v2\":\"$(git rev-parse HEAD)\",\"v1\":\"$(git rev-parse HEAD^)\",\"component\":\"tree--change-tree-data\"}") | |
echo "Task id is $id" | |
for i in {1..30}; do | |
sleep 2 | |
json_data=$(curl --location 'http://localhost:6789/analyze/checkAllTask' --header 'X-TT-ENV: canary' --header "X-SEMI-Request: ${{ secrets.SEMI_REQUEST }}") | |
parsed_data=$(python -c " | |
import json; | |
data = json.loads('''$json_data'''); | |
for item in data: | |
if item['id'] == $id : | |
if item['status'] == 'done': | |
print('Done: result is '+ ('empty' if item['result']=='' else item['result'])) | |
else: | |
print('') | |
exit(0) | |
print("") | |
") | |
if [ -n "$parsed_data" ]; then | |
echo "$parsed_data" | |
break | |
else | |
echo "task result is empty at tried number #$i" | |
fi | |
done |