forked from pytorch/executorch
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (75 loc) · 3.22 KB
/
Copy pathweekly-pytorch-pin-bump.yml
File metadata and controls
93 lines (75 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Weekly PyTorch Pin Bump
on:
schedule:
- cron: '0 9 * * 1' # Monday 9:00 UTC
workflow_dispatch:
jobs:
create-pin-bump-pr:
if: github.repository_owner == 'pytorch'
runs-on: ubuntu-latest
environment: update-commit-hash
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.UPDATEBOT_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Determine nightly version
id: nightly
run: |
NIGHTLY_DATE=$(date -u -d 'yesterday' '+%Y%m%d')
NIGHTLY_VERSION="dev${NIGHTLY_DATE}"
echo "version=${NIGHTLY_VERSION}" >> "$GITHUB_OUTPUT"
- name: Read current TORCH_VERSION
id: torch
run: |
TORCH_VERSION=$(python -c "exec(open('torch_pin.py').read()); print(TORCH_VERSION)")
echo "version=${TORCH_VERSION}" >> "$GITHUB_OUTPUT"
- name: Update torch_pin.py with new NIGHTLY_VERSION
run: |
printf 'TORCH_VERSION = "%s"\nNIGHTLY_VERSION = "%s"\n' \
"${{ steps.torch.outputs.version }}" \
"${{ steps.nightly.outputs.version }}" > torch_pin.py
- name: Run pin bump script
run: python .github/scripts/update_pytorch_pin.py
- name: Create branch and PR
env:
GH_TOKEN: ${{ secrets.UPDATEBOT_TOKEN }}
run: |
BRANCH="automated/pytorch-pin-bump-${{ steps.nightly.outputs.version }}"
git config user.name "pytorchbot"
git config user.email "pytorchbot@users.noreply.github.com"
git checkout -b "${BRANCH}"
git add torch_pin.py
git add .ci/docker/ci_commit_pins/pytorch.txt
git add runtime/core/portable_type/c10/
if git diff --cached --quiet; then
echo "No changes to commit. Pin is already up to date."
exit 0
fi
git commit -m "Bump PyTorch pin to nightly ${{ steps.nightly.outputs.version }}"
git push -u origin "${BRANCH}"
EXISTING=$(gh pr list --label "ci/pytorch-pin-bump" --state open --json number --jq '.[0].number')
if [ -n "${EXISTING}" ]; then
echo "Closing existing pin bump PR #${EXISTING} in favor of new one"
gh pr close "${EXISTING}" --comment "Superseded by newer pin bump."
fi
NIGHTLY="${{ steps.nightly.outputs.version }}"
read -r -d '' PR_BODY <<EOF || true
## Summary
Automated weekly PyTorch pin bump.
- Updates \`NIGHTLY_VERSION\` in \`torch_pin.py\` to \`${NIGHTLY}\`
- Updates \`.ci/docker/ci_commit_pins/pytorch.txt\` to the corresponding nightly commit hash
- Syncs c10 headers from PyTorch into \`runtime/core/portable_type/c10/\`
This PR was created automatically. If CI fails, Claude will attempt to fix issues (up to 3 attempts). If CI still fails, human review will be requested.
cc @jakeszwe
EOF
PR_BODY=$(echo "${PR_BODY}" | sed 's/^ //')
gh pr create \
--title "Bump PyTorch pin to nightly ${NIGHTLY}" \
--body "${PR_BODY}" \
--label "ci/pytorch-pin-bump"