Skip to content

Get latest PyTorch version release branch #174

Get latest PyTorch version release branch

Get latest PyTorch version release branch #174

name: Get latest PyTorch version release branch
on:
workflow_dispatch:
env:
working_branch: support/new-pytorch-${{ github.ref_name }}
base_branch: ${{ github.ref_name }}
permissions:
contents: write
issues: write
pull-requests: write
jobs:
get-version:
runs-on: ubuntu-latest
if: ${{ github.repository }} == 'hemlholtz-analytics/heat'
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
ref: '${{ env.base_branch }}'
- name: Fetch PyTorch release version
run: |
curl -sL https://api.github.com/repos/pytorch/pytorch/releases/latest | \
jq -r ".tag_name" | tr -d 'v' > .github/pytorch-release-versions/pytorch-latest.txt
- name: Check if file has been modified
id: git-check
run: echo "::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "false" || echo "true")"
- name: Delete working branch if it already exists
run: git push --delete origin ${{ env.working_branch }} || true
- name: Commit latest PyTorch release version to new branch
if: ${{ steps.git-check.outputs.modified == 'true' }}
run: |
git checkout -b ${{ env.working_branch }}
echo "new=$(<.github/pytorch-release-versions/pytorch-latest.txt)" >> $GITHUB_ENV
git config --global user.name 'ClaudiaComito'
git config --global user.email 'c.comito@fz-juelich.de@users.noreply.github.com'
git commit -am "New PyTorch release ${{ env.new }}"
git push --set-upstream origin ${{ env.working_branch }}
call-workflow:
needs: get-version
uses: ./.github/workflows/latest-pytorch-support.yml
with:
working_branch: support/new-pytorch-${{ github.ref_name }}
base_branch: ${{ github.ref_name }}