Skip to content

Commit

Permalink
Update latest-pytorch-support.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mtar authored Nov 28, 2023
1 parent bb5c587 commit 8073b3e
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions .github/workflows/latest-pytorch-support.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Support latest PyTorch

on:
push:
branches:
- 'support/new-pytorch-release-branch'
- 'support/new-pytorch-main-branch'
paths:
- '.github/pytorch-release-versions/*'
env:
working_branch: ${{ github.ref }}
workflow_call:
inputs:
working_branch:
required: true
type: string
base_branch:
required: true
type: string
permissions:
contents: write
issues: write
Expand All @@ -17,7 +17,7 @@ jobs:
latest-torch-support:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -29,10 +29,10 @@ jobs:
update_existing: true
search_existing: open
- name: Check out new branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: '${{ env.working_branch }}'
ref: '${{ inputs.working_branch }}'
- name: Set env variables
run: |
echo "previous_pytorch=$(grep 'torch>=' setup.py | awk -F '<' '{print $2}' | tr -d '",')" >> $GITHUB_ENV
Expand All @@ -44,22 +44,15 @@ jobs:
- name: Update setup.py
run: |
sed -i '/torch>=/ s/'"${{ env.previous_pytorch }}"'/'"${{ env.setup_pytorch }}"'/g' setup.py
- name: Define base branch
run: |
if [[ ${{ github.ref }} =~ .*main.* ]]; then
echo "base_branch=main" >> $GITHUB_ENV
elif [[ ${{ github.ref }} =~ .*release.* ]]; then
echo "base_branch=release/1.2.x" >> $GITHUB_ENV
fi
- name: Create PR from branch
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
base: ${{ env.base_branch }}
branch: ${{ env.working_branch }}
base: ${{ inputs.base_branch }}
branch: ${{ inputs.working_branch }}
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Support latest PyTorch release
title: Support PyTorch ${{ env.new_pytorch }} on branch ${{ env.base_branch }}
title: Support PyTorch ${{ env.new_pytorch }} on branch ${{ inputs.base_branch }}
body: |
Run tests on latest PyTorch release
Issue/s resolved: #${{ steps.create-issue.outputs.number }}
Expand Down

0 comments on commit 8073b3e

Please sign in to comment.