|
| 1 | +# This workflow automates creation of uplift pull requests. |
| 2 | +# Uplift PR is created daily to uplift the submodule to the latest version. |
| 3 | + |
| 4 | +name: Nighty Uplift |
| 5 | + |
| 6 | +on: |
| 7 | + schedule: |
| 8 | + - cron: '0 8 * * *' # Runs at 08:00 UTC every day |
| 9 | + workflow_dispatch: # Manual trigger |
| 10 | + |
| 11 | +jobs: |
| 12 | + uplift-pr: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + env: |
| 16 | + SUBMODULE_PATH: third_party/tt-mlir |
| 17 | + MLIR_VERSION: origin/main |
| 18 | + |
| 19 | + steps: |
| 20 | + |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: recursive |
| 24 | + fetch-depth: 0 # Fetch all history and tags |
| 25 | + ref: main |
| 26 | + |
| 27 | + - name: Set env variable |
| 28 | + run: | |
| 29 | + echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV |
| 30 | +
|
| 31 | + - name: Update tt-mlir reference |
| 32 | + run: | |
| 33 | + # Fetch the latest SHA using GitHub CLI |
| 34 | + LATEST_SHA=$(gh api repos/tenstorrent/tt-mlir/commits/main --jq '.sha') |
| 35 | + # Update the CMakeLists.txt file with the new SHA |
| 36 | + sed -i "s/set(TT_MLIR_VERSION \".*\")/set(TT_MLIR_VERSION \"${LATEST_SHA}\")/" third_party/CMakeLists.txt |
| 37 | +
|
| 38 | + - name: Create Pull Request |
| 39 | + uses: peter-evans/create-pull-request@v7 |
| 40 | + id: create-pr |
| 41 | + with: |
| 42 | + branch: uplift |
| 43 | + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
| 44 | + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> |
| 45 | + base: main |
| 46 | + commit-message: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" |
| 47 | + title: "Uplift ${{ env.SUBMODULE_PATH }} to ${{ env.SUBMODULE_VERSION }} ${{ env.TODAY }}" |
| 48 | + body: "This PR uplifts the ${{ env.SUBMODULE_PATH }} to the ${{ env.SUBMODULE_VERSION }}" |
| 49 | + labels: uplift |
| 50 | + delete-branch: true |
| 51 | + token: ${{ secrets.GH_TOKEN }} |
| 52 | + |
| 53 | + - name: Approve Pull Request |
| 54 | + if: ${{ steps.create-pr.outputs.pull-request-number }} |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ secrets.GH_APPROVE_TOKEN }} |
| 57 | + run: | |
| 58 | + echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}" |
| 59 | + echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}" |
| 60 | + gh pr review ${{ steps.create-pr.outputs.pull-request-number }} --approve |
| 61 | + |
| 62 | + - name: Enable Pull Request Automerge |
| 63 | + if: ${{ steps.create-pr.outputs.pull-request-number }} |
| 64 | + run: gh pr merge --squash --auto "${{ steps.create-pr.outputs.pull-request-number }}" |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
0 commit comments