Skip to content

Commit d847751

Browse files
committed
Add action.yml
1 parent 956e36c commit d847751

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Fetch and Rebase
2+
3+
description: Fetch and rebase for repository
4+
5+
inputs:
6+
repo_path:
7+
description: the path the repository locate on
8+
required: true
9+
remote_branch:
10+
description: the branch rebased from
11+
required: true
12+
loop:
13+
description: loop times when fails
14+
required: true
15+
16+
runs:
17+
using: composite
18+
steps:
19+
- name: Fetch and rebase
20+
env:
21+
REPO_PATH: ${{ inputs.repo_path }}
22+
REMOTE_BRANCH: ${{ inputs.remote_branch }}
23+
LOOP: ${{ inputs.loop }}
24+
shell: bash
25+
run: |
26+
set +e
27+
28+
COUNT=0
29+
30+
for i in $(seq 1 ${LOOP})
31+
do
32+
pushd ${REPO_PATH} &&
33+
git fetch --all &&
34+
git rebase ${REMOTE_BRANCH} &&
35+
git submodule sync &&
36+
git submodule update --init --recursive &&
37+
git reset --hard HEAD &&
38+
git clean -dfx &&
39+
git submodule foreach git reset --hard HEAD &&
40+
git submodule foreach git clean -dfx &&
41+
popd
42+
43+
if [[ $? -ne 0 ]]
44+
then
45+
let COUNT++
46+
else
47+
break
48+
fi
49+
done
50+
51+
[[ ${COUNT} -lt ${LOOP} ]] && true || false

.github/workflows/_fetch_and_rebase.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
runs-on: ${{ inputs.runner }}
1818
steps:
1919
- name: Pull latest codes for torch
20-
uses: ascend/pytorch/.github/actions/fetch-and-rebase@master
20+
uses: cosdt/pytorch-integration-tests/.github/actions/fetch-and-rebase@main
2121
with:
2222
repo_path: /home/runner/actions-runner/codes/pytorch/pytorch
2323
remote_branch: upstream/main
2424
loop: ${{ inputs.loop }}
2525
- name: Pull latest codes for torch_npu
26-
uses: ascend/pytorch/.github/actions/fetch-and-rebase@master
26+
uses: cosdt/pytorch-integration-tests/.github/actions/fetch-and-rebase@main
2727
with:
2828
repo_path: /home/runner/actions-runner/codes/npu/pytorch
2929
remote_branch: upstream/master

0 commit comments

Comments
 (0)