Skip to content

Commit cbbefa2

Browse files
Support pin pr number in new .torch_pin (pytorch#6998)
Co-authored-by: Will Cromar <wcromar@google.com>
1 parent 400bd0c commit cbbefa2

File tree

1 file changed

+11
-2
lines changed
  • infra/ansible/roles/build_srcs/tasks

1 file changed

+11
-2
lines changed

infra/ansible/roles/build_srcs/tasks/main.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88
# ansible.builtin.git wants to fetch the entire history, so check out the pin manually
99
ansible.builtin.shell:
1010
cmd: |
11-
git fetch origin {{ torch_pin.stdout }}
12-
git checkout --recurse-submodules {{ torch_pin.stdout }}
11+
set -xe
12+
PIN="{{ torch_pin.stdout }}"
13+
if [[ $PIN = \#* ]]; then
14+
PRNUM="${PIN//[!0-9]/}"
15+
git fetch origin "pull/$PRNUM/head"
16+
else
17+
git fetch origin {{ torch_pin.stdout }}
18+
fi
19+
git checkout --recurse-submodules FETCH_HEAD
1320
chdir: "{{ (src_root, 'pytorch') | path_join }}"
21+
args:
22+
executable: /bin/bash
1423
when: torch_pin is succeeded
1524

1625
- name: Build PyTorch

0 commit comments

Comments
 (0)