Skip to content

Commit

Permalink
Rework dependency updates to avoid force pushing. (#852)
Browse files Browse the repository at this point in the history
See iree-org/iree-turbine#397 for details. This
has the same changes, but using `shark-pr-automator[bot]
<41898282+github-actions[bot]@users.noreply.github.com>` instead of
`iree-pr-automator[bot] <[email protected]>` as the
commit author.

---------

Co-authored-by: Marius Brehler <[email protected]>
  • Loading branch information
ScottTodd and marbre authored Jan 21, 2025
1 parent f743696 commit 5040e87
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions .github/workflows/update_iree_requirement_pins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ name: Update IREE requirement pins

on:
workflow_dispatch:
inputs:
branch-name:
default: "integrates/iree"
type: string
description: The branch name to put updates on
schedule:
# Weekdays at 11:00 AM UTC = 03:00 AM PST / 04:00 AM PDT
- cron: "0 11 * * 1-5"
Expand All @@ -16,45 +21,76 @@ permissions:
contents: write
pull-requests: write

env:
GIT_BRANCH_NAME: ${{ inputs.branch-name || 'integrates/iree' }}

jobs:
update-iree:
check-for-existing-branch:
if: ${{ github.repository_owner == 'nod-ai' || github.event_name != 'schedule' }}
runs-on: ubuntu-24.04
outputs:
branch-exists: ${{ steps.check-exists.outputs.branch-exists }}

steps:
- uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
id: generate-token
with:
app-id: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_ID }}
private-key: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check for existing integrate branch
id: check-exists
run: |
BRANCH_EXISTS=$(git ls-remote --exit-code --heads origin ${{ env.GIT_BRANCH_NAME }} | wc -l)
echo branch-exists=${BRANCH_EXISTS} >> "${GITHUB_OUTPUT}"
if [[ ${BRANCH_EXISTS} == 1 ]]; then
echo "Skipping update PR creation since the `${{ env.GIT_BRANCH_NAME }}` branch already exists." >> ${GITHUB_STEP_SUMMARY}
fi
update-iree:
needs: check-for-existing-branch
runs-on: ubuntu-22.04
if: ${{ needs.check-for-existing-branch.outputs.branch-exists == 0 }}

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: "Setting up Python"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.11

# This sets a few environment variables used below.
# This sets a few environment variables via GITHUB_ENV.
- name: Update IREE requirement pins
run: build_tools/update_iree_requirement_pins.py

- uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
if: ${{ env.CREATE_PULL_REQUEST_TOKEN_APP_ID != '' && env.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY != '' }}
id: generate-token
with:
app-id: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_ID }}
private-key: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY }}
env:
CREATE_PULL_REQUEST_TOKEN_APP_ID: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_ID }}
CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY: ${{ secrets.CREATE_PULL_REQUEST_TOKEN_APP_PRIVATE_KEY }}

- name: Create or update pull request
if: |
${{ env.CURRENT_IREE_BASE_COMPILER_VERSION }} != ${{ env.LATEST_IREE_BASE_COMPILER_VERSION }} || \
${{ env.CURRENT_IREE_BASE_RUNTIME_VERSION }} != ${{ env.LATEST_IREE_BASE_RUNTIME_VERSION }} || \
${{ env.CURRENT_IREE_TURBINE_VERSION }} != ${{ env.LATEST_IREE_TURBINE_VERSION }}
${{ env.CURRENT_SHORTFIN_IREE_GIT_TAG }} != ${{ env.LATEST_SHORTFIN_IREE_GIT_TAG }}
id: cpr
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
token: ${{ steps.generate-token.outputs.token }}
token: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
base: main
branch: integrates/iree
delete-branch: true
branch: ${{ env.GIT_BRANCH_NAME }}
author: shark-pr-automator[bot] <41898282+github-actions[bot]@users.noreply.github.com>
signoff: true
title: "Bump IREE requirement pins to their latest versions."
body: |
Diff: https://github.com/iree-org/iree/compare/iree-${{ env.CURRENT_IREE_BASE_COMPILER_VERSION }}...iree-${{ env.LATEST_IREE_BASE_COMPILER_VERSION }}
Auto-generated by GitHub Actions using [`.github/workflows/update_iree_requirement_pins.yml`](https://github.com/${{ github.repository }}/blob/main/.github/workflows/update_iree_requirement_pins.yml).
commit-message: "Bump IREE to ${{ env.LATEST_IREE_BASE_COMPILER_VERSION }}."

- name: Write summary
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request URL: ${{ steps.cpr.outputs.pull-request-url }}" >> ${GITHUB_STEP_SUMMARY}

0 comments on commit 5040e87

Please sign in to comment.