|
| 1 | +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 2 | +# See https://llvm.org/LICENSE.txt for license information. |
| 3 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 | +# Copyright (c) 2024. |
| 5 | + |
| 6 | +name: Auto Integrate LLVM |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + pull_request: |
| 10 | + schedule: |
| 11 | + # At minute 0 past hour 1. (see https://crontab.guru) |
| 12 | + - cron: '00 01 * * *' |
| 13 | +jobs: |
| 14 | + update-dep: |
| 15 | + |
| 16 | + name: "Integrate LLVM and send PR" |
| 17 | + |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + permissions: |
| 21 | + contents: write |
| 22 | + pull-requests: write |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: "Check out repository" |
| 26 | + uses: actions/checkout@v4.2.2 |
| 27 | + |
| 28 | + - name: "Get filtered llvm-project" |
| 29 | + id: get-llvm-project |
| 30 | + run: | |
| 31 | + |
| 32 | + pushd /tmp |
| 33 | + git clone https://github.com/llvm/llvm-project.git |
| 34 | + pushd /llvm-project |
| 35 | + echo "LLVM_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 36 | + git filter-repo --subdirectory-filter mlir/lib/Bindings/Python |
| 37 | + |
| 38 | + popd |
| 39 | + popd |
| 40 | +
|
| 41 | + - name: "Rebase on top of llvm-project" |
| 42 | + id: rebase-llvm-project |
| 43 | + run: | |
| 44 | + |
| 45 | + git pull /tmp/llvm-project main --rebase |
| 46 | +
|
| 47 | + - name: Generate token |
| 48 | + uses: actions/create-github-app-token@v1 |
| 49 | + id: generate-token |
| 50 | + with: |
| 51 | + app-id: ${{ secrets.BUMP_LLVM_CREATE_PR_APP_ID }} |
| 52 | + private-key: ${{ secrets.BUMP_LLVM_CREATE_PR_APP_PRIVATE_KEY }} |
| 53 | + |
| 54 | + - name: "Create Pull Request" |
| 55 | + id: cpr |
| 56 | + uses: peter-evans/create-pull-request@v7 |
| 57 | + with: |
| 58 | + token: ${{ steps.generate-token.outputs.token }} |
| 59 | + commit-message: "[LLVM] Integrate to ${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}" |
| 60 | + title: "[LLVM] Integrate to ${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}" |
| 61 | + body: "Integrate LLVM to https://github.com/llvm/llvm-project/commit/${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}" |
| 62 | + author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>' |
| 63 | + base: main |
| 64 | + branch: update-llvm |
| 65 | + delete-branch: true |
| 66 | + assignees: makslevental |
| 67 | + reviewers: makslevental |
| 68 | + |
| 69 | + - name: Enable auto-merge |
| 70 | + uses: peter-evans/enable-pull-request-automerge@v3 |
| 71 | + with: |
| 72 | + token: ${{ steps.generate-token.outputs.token }} |
| 73 | + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} |
| 74 | + merge-method: squash |
| 75 | + |
| 76 | + - name: Auto approve |
| 77 | + run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}" |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + merge-method: squash |
0 commit comments