Skip to content

Commit 6882da3

Browse files
authored
代码同步支持commit指定 (#3016) (#3019)
fix code sync bug (#3017) * 代码同步支持commit指定 * fix PaddleQACheckout 1.1 use bug fix actions bug (#3018) fix actions bug 增加单文件代码同步
1 parent 0c68175 commit 6882da3

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/workflows/repo_sync_dispatch_test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,18 @@ jobs:
4646
tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }}
4747
python -m pip install bce-python-sdk==0.8.74
4848
# 获取远端的最新提交时间
49-
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=""
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
5050
# 判断 latest_commit_time_remote 是否晚于 current_commit_time 时间
5151
if [ -n "$latest_commit_time_remote" ] && [ "$latest_commit_time_remote" -lt "$current_commit_time" ]; then
5252
echo "Executing upload as latest commit time ($latest_commit_time_remote) is earlier than current commit time ($current_commit_time)."
5353
python tools/bos_upload.py ${file_name} paddle-qa/CodeSync/${{ github.event.client_payload.ref }}/
5454
echo "Bos link: https://paddle-qa.bj.bcebos.com/CodeSync/${{ github.event.client_payload.ref }}/$file_name"
5555
echo "${current_commit_time}" >> latest_commit_time
56-
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
56+
python tools/bos_upload.py latest_commit_time paddle-qa/CodeSync/GitInfo/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }}
57+
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"
5761
else
5862
echo "The latest commit time is later than the current commit. Skipping the commit operation."
5963
fi
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: tools file sync to bos
2+
run-name: Tools file synchronization
3+
on:
4+
push:
5+
paths:
6+
- 'tools/bos_upload.py'
7+
- 'tools/linux_env_info.sh'
8+
workflow_dispatch:
9+
10+
jobs:
11+
upload_bos:
12+
if: ${{ !github.event.repository.fork }}
13+
environment: CodeSync
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: PaddleTest Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
sparse-checkout: |
20+
tools
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
- name: Upload Code
25+
env:
26+
AK: ${{ secrets.BOS_AK }}
27+
SK: ${{ secrets.BOS_SK }}
28+
run: |
29+
tree -L 3
30+
echo "Repository: ${{ github.repository }}"
31+
echo "Branch: ${{ github.ref }}"
32+
python -m pip install bce-python-sdk==0.8.74
33+
branch=$(echo '${{ github.ref }}' | sed 's#refs/heads/##')
34+
python tools/bos_upload.py tools/bos_upload.py paddle-qa/CodeSync/${branch}/${{ github.repository }}
35+
python tools/bos_upload.py tools/linux_env_info.sh paddle-qa/CodeSync/${branch}/${{ github.repository }}
36+

0 commit comments

Comments
 (0)