Skip to content

Commit

Permalink
代码同步支持commit指定 (#3016) (#3019)
Browse files Browse the repository at this point in the history
fix code sync bug (#3017)

* 代码同步支持commit指定

* fix PaddleQACheckout 1.1 use bug

fix actions bug (#3018)

fix actions bug

增加单文件代码同步
  • Loading branch information
XieYunshen authored Jan 10, 2025
1 parent 0c68175 commit 6882da3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/repo_sync_dispatch_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ jobs:
tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }}
python -m pip install bce-python-sdk==0.8.74
# 获取远端的最新提交时间
latest_commit_time_remote=$(curl --silent --fail https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time) || latest_commit_time_remote=""
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
# 判断 latest_commit_time_remote 是否晚于 current_commit_time 时间
if [ -n "$latest_commit_time_remote" ] && [ "$latest_commit_time_remote" -lt "$current_commit_time" ]; then
echo "Executing upload as latest commit time ($latest_commit_time_remote) is earlier than current commit time ($current_commit_time)."
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
echo "${current_commit_time}" >> latest_commit_time
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
echo "${current_commit}" >> latest_commit
python tools/bos_upload.py latest_commit paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_sha"
echo "GitInfo link: https://paddle-qa.bj.bcebos.com/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}/latest_commit_time"
else
echo "The latest commit time is later than the current commit. Skipping the commit operation."
fi
36 changes: 36 additions & 0 deletions .github/workflows/single_file_sync_auto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tools file sync to bos
run-name: Tools file synchronization
on:
push:
paths:
- 'tools/bos_upload.py'
- 'tools/linux_env_info.sh'
workflow_dispatch:

jobs:
upload_bos:
if: ${{ !github.event.repository.fork }}
environment: CodeSync
runs-on: ubuntu-latest
steps:
- name: PaddleTest Checkout
uses: actions/checkout@v4
with:
sparse-checkout: |
tools
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Upload Code
env:
AK: ${{ secrets.BOS_AK }}
SK: ${{ secrets.BOS_SK }}
run: |
tree -L 3
echo "Repository: ${{ github.repository }}"
echo "Branch: ${{ github.ref }}"
python -m pip install bce-python-sdk==0.8.74
branch=$(echo '${{ github.ref }}' | sed 's#refs/heads/##')
python tools/bos_upload.py tools/bos_upload.py paddle-qa/CodeSync/${branch}/${{ github.repository }}
python tools/bos_upload.py tools/linux_env_info.sh paddle-qa/CodeSync/${branch}/${{ github.repository }}

0 comments on commit 6882da3

Please sign in to comment.