Paddle kits repos sync Runs on repository_dispatch #1506
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: Paddle kits repos sync via repository_dispatch | |
run-name: Paddle kits repos sync Runs on ${{ github.event_name }} | |
on: | |
repository_dispatch: | |
types: [sync-event] | |
jobs: | |
paddleqa-checkout: | |
environment: CodeSync | |
runs-on: ubuntu-latest | |
name: Repo Checkout and Upload | |
steps: | |
- name: PaddleTest Checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
tools | |
- name: Code Checkout | |
id: checkout | |
uses: XieYunshen/[email protected] | |
with: | |
repository: ${{ github.event.client_payload.repository }} | |
ref: ${{ github.event.client_payload.ref }} | |
submodules: ${{ github.event.client_payload.submodules }} | |
fetch_depth: ${{ github.event.client_payload.fetch_depth }} | |
path: ${{ github.event.client_payload.path }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Upload Code | |
env: | |
AK: ${{ secrets.BOS_AK }} | |
SK: ${{ secrets.BOS_SK }} | |
run: | | |
git log -n 3 | |
current_commit=$(git rev-parse HEAD) | |
tree -L 3 | |
REPO_NAME=${{ github.event.client_payload.repository }} | |
REPO_NAME=${REPO_NAME##*/} | |
file_name=$REPO_NAME.tar | |
cd ${{ github.event.client_payload.path }} | |
current_commit=$(git rev-parse HEAD) | |
current_commit_time=$(git show -s --format=%ct HEAD) | |
cd - | |
tar -cf $REPO_NAME.tar ${{ github.event.client_payload.path }} | |
python -m pip install bce-python-sdk==0.8.74 | |
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}" >> ${current_commit} | |
python tools/bos_upload.py ${current_commit} paddle-qa/CodeSync/${{ github.event.client_payload.repository }}/${{ github.event.client_payload.ref }} | |
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 }} |