Update latest-pytorch-support.yml #185
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Support latest PyTorch | ||
on: | ||
workflow_call | ||
env: | ||
working_branch: ${{ github.ref }} | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
jobs: | ||
latest-torch-support: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: JasonEtco/create-an-issue@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
id: | ||
create-issue | ||
with: | ||
filename: .github/ISSUE_TEMPLATE/support_latest_pytorch.md | ||
milestone: 1 | ||
update_existing: true | ||
search_existing: open | ||
- name: Check out new branch | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
ref: '${{ env.working_branch }}' | ||
- name: Set env variables | ||
run: | | ||
echo "previous_pytorch=$(grep 'torch>=' setup.py | awk -F '<' '{print $2}' | tr -d '",')" >> $GITHUB_ENV | ||
echo "new_pytorch=$(<.github/pytorch-release-versions/pytorch-latest.txt)" >> $GITHUB_ENV | ||
- name: Increment version | ||
run: | | ||
chmod +x .github/workflows/increment_version.sh | ||
echo "setup_pytorch=$(.github/workflows/increment_version.sh ${{ env.new_pytorch }})" >> $GITHUB_ENV | ||
- 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@v5 | ||
# with: | ||
# base: ${{ env.base_branch }} | ||
# branch: ${{ env.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 }} | ||
# body: | | ||
# Run tests on latest PyTorch release | ||
# Issue/s resolved: #${{ steps.create-issue.outputs.number }} | ||
# Auto-generated by [create-pull-request][1] | ||
# [1]: https://github.com/peter-evans/create-pull-request | ||
# reviewers: ClaudiaComito, mtar, JuanPedroGHM | ||
- name: create pull request | ||
run: gh pr create -B ${{ env.base_branch }} -H ${{ env.working_branch }} --title Support PyTorch ${{ env.new_pytorch }} on branch ${{ env.base_branch }} --body 'Run tests on latest PyTorch release\nIssue/s resolved: ' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |