1- name : Paddle kits repos sync via repository_dispatch
2- run-name : Paddle kits repos sync Runs on ${{ github.event_name }}
1+ name : Paddle Repos Sync Triggered by Commit Using Repository Dispatch
2+ run-name : Paddle repos sync runs triggered by commit using ${{ github.event_name }}
33on :
44 repository_dispatch :
5- types : [sync-event-test ]
5+ types : [sync-event-commit ]
66
77jobs :
88 paddleqa-checkout :
2525 fetch_depth : ${{ github.event.client_payload.fetch_depth }}
2626 path : ${{ github.event.client_payload.path }}
2727 commit_sha : ${{ github.event.client_payload.commit_sha }}
28+ repo_compress : ${{ github.event.client_payload.repo_compress }}
2829 - uses : actions/setup-python@v5
2930 with :
3031 python-version : ' 3.10'
3435 SK : ${{ secrets.BOS_SK }}
3536 run : |
3637 git log -n 3
37- current_commit=$(git rev-parse HEAD)
3838 tree -L 3
39+ current_commit=$(git rev-parse HEAD)
3940 REPO_NAME=${{ github.event.client_payload.repository }}
4041 REPO_NAME=${REPO_NAME##*/}
4142 file_name=$REPO_NAME.tar
@@ -46,18 +47,18 @@ jobs:
4647 tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }}
4748 python -m pip install bce-python-sdk==0.8.74
4849 # 获取远端的最新提交时间
49- latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time) || latest_commit_time_remote=0
50+ latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/ latest_commit_time) || latest_commit_time_remote=0
5051 # 判断 latest_commit_time_remote 是否晚于 current_commit_time 时间
5152 if [ -n "$latest_commit_time_remote" ] && [ "$latest_commit_time_remote" -lt "$current_commit_time" ]; then
5253 echo "Executing upload as latest commit time ($latest_commit_time_remote) is earlier than current commit time ($current_commit_time)."
53- python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
54- echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
54+ python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
55+ echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/$ file_name"
5556 echo "${current_commit_time}" >> latest_commit_time
56- python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
57+ python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
5758 echo "${current_commit}" >> latest_commit
58- python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
59- echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_sha"
60- echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time"
59+ python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}
60+ echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/ latest_commit_sha"
61+ echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/${{ github.event.client_payload.commit_sha }}/ latest_commit_time"
6162 else
6263 echo "The latest commit time is later than the current commit. Skipping the commit operation."
6364 fi
0 commit comments